Merge branch 'main' into scrut-sysexits
This commit is contained in:
commit
6132c9bf47
18
src/mm.c
18
src/mm.c
@ -106,6 +106,15 @@ oserr(char *s, char *r){
|
||||
} \
|
||||
return retval
|
||||
|
||||
/* Prints a usage text, in which s is the program being run (i.e. argv[0]), and
|
||||
* returns an exit status appropriate for a usage error. */
|
||||
int usage(char *s){
|
||||
|
||||
fprintf(stderr, "Usage: %s (-aenu) (-i [input])... (-o [output])...\n", s);
|
||||
|
||||
return EX_USAGE;
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]){
|
||||
int c;
|
||||
struct Files files[2]; /* {read, write} */
|
||||
@ -178,12 +187,15 @@ int main(int argc, char *argv[]){
|
||||
k = 1;
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "Usage: %s (-aenu) (-i [input])..."
|
||||
" (-o [output])...\n", argv[0]);
|
||||
retval = EX_USAGE;
|
||||
retval = usage(argv[0]);
|
||||
terminate;
|
||||
}
|
||||
|
||||
if(optind != argc){
|
||||
retval = usage(argv[0]);
|
||||
terminate;
|
||||
}
|
||||
|
||||
files[0].s += files[0].s == 0;
|
||||
files[1].s += files[1].s == 0;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user