Make usage printing more consistent with other tools.
- Introduce a separate usage() function. - Don't use argv[0]. Directly name the application, as we do elsewhere. - Don't prepend the application name. - Don't print two newlines.
This commit is contained in:
parent
fc8a412064
commit
28c93d1bb4
@ -196,6 +196,14 @@ static void offtout(off_t x,u_char *buf)
|
||||
if(x<0) buf[7]|=0x80;
|
||||
}
|
||||
|
||||
static void
|
||||
usage(void)
|
||||
{
|
||||
|
||||
fprintf(stderr, "usage: bsdiff oldfile newfile patchfile\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
int main(int argc,char *argv[])
|
||||
{
|
||||
int fd;
|
||||
@ -216,7 +224,8 @@ int main(int argc,char *argv[])
|
||||
BZFILE * pfbz2;
|
||||
int bz2err;
|
||||
|
||||
if(argc!=4) errx(1,"usage: %s oldfile newfile patchfile\n",argv[0]);
|
||||
if (argc != 4)
|
||||
usage();
|
||||
|
||||
/* Allocate oldsize+1 bytes instead of oldsize bytes to ensure
|
||||
that we never try to malloc(0) and get a NULL pointer */
|
||||
|
@ -57,6 +57,14 @@ static off_t offtin(u_char *buf)
|
||||
return y;
|
||||
}
|
||||
|
||||
static void
|
||||
usage(void)
|
||||
{
|
||||
|
||||
fprintf(stderr, "usage: bspatch oldfile newfile patchfile\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
int main(int argc,char * argv[])
|
||||
{
|
||||
FILE * f, * cpf, * dpf, * epf;
|
||||
@ -72,7 +80,8 @@ int main(int argc,char * argv[])
|
||||
off_t lenread;
|
||||
off_t i;
|
||||
|
||||
if(argc!=4) errx(1,"usage: %s oldfile newfile patchfile\n",argv[0]);
|
||||
if (argc != 4)
|
||||
usage();
|
||||
|
||||
/* Open patch file */
|
||||
if ((f = fopen(argv[3], "rb")) == NULL)
|
||||
|
Loading…
Reference in New Issue
Block a user