vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| On Mon, Apr 23, 2007 at 04:13:24PM +0100, Jason McIntyre wrote: > the usage() part at least will go in, i'll make sure of that. Thanks. > you need at least "\t" before [-j ...] to provide a little indent. if > you can remail the diff with that please... OK, although the spacing is done right behind \n (12 white spaces). I changed it and have used \t + 4 white spaces in next line (as requested). --- usr.bin/join/join.c~ Mon Apr 23 15:59:30 2007 +++ usr.bin/join/join.c Mon Apr 23 17:17:05 2007 @@ -338,7 +338,6 @@ * the two structures so that we don't lose space allocated to * either structure. This could be avoided by doing another * level of indirection, but it's probably okay as is. - * but it's probably okay as is. */ lp = &F->set[F->setcnt]; if (F->pushbool) { @@ -601,21 +600,16 @@ */ switch(ap[2]) { case '1': - if (ap[3] != '\0') - goto jbad; - ap[1] = '1'; - ap[2] = '\0'; - break; case '2': if (ap[3] != '\0') goto jbad; - ap[1] = '2'; + ap[1] = ap[2]; ap[2] = '\0'; break; case '\0': break; default: -jbad: errx(1, "illegal option -- %s", ap); +jbad: warnx("illegal option -- %s", ap + 1); usage(); } break; @@ -624,7 +618,7 @@ * The original join allowed "-o arg arg". * Convert to "-o arg -o arg". */ - if (ap[2] != '\0') + if (ap[2] != '\0' || argv[1] == NULL) break; for (p = argv + 2; *p != NULL; ++p) { if (p[0][0] == '0' || ((p[0][0] != '1' && @@ -649,8 +643,11 @@ void usage(void) { - (void)fprintf(stderr, "%s%s\n", - "usage: join [-a fileno | -v fileno ] [-e string] [-1 field] ", - "[-2 field]\n [-o list] [-t char] file1 file2"); + extern char *__progname; + + (void)fprintf(stderr, "usage: %s [-1 field] [-2 field] " + "[-a file_number | -v file_number] [-e string]\n" + "\t [-j file_number field] [-o list] [-t char] file1 file2\n", + __progname); exit(1); } |