diff options
author | emaste <emaste@FreeBSD.org> | 2016-09-22 21:14:00 +0000 |
---|---|---|
committer | emaste <emaste@FreeBSD.org> | 2016-09-22 21:14:00 +0000 |
commit | b372ba880f673f21dc91f5e801dd88ff9daa5f26 (patch) | |
tree | 0bd43baafefb64850d904d2f6ca19cf7737c992d /usr.bin/bsdiff/bspatch/bspatch.c | |
parent | 815c47c03bec30e97fcaccf870c39b17c7c01a55 (diff) | |
download | FreeBSD-src-b372ba880f673f21dc91f5e801dd88ff9daa5f26.zip FreeBSD-src-b372ba880f673f21dc91f5e801dd88ff9daa5f26.tar.gz |
MFC r264823 (ed): 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.
Also apply the unnecessary semicolon cleanup from r298089
Diffstat (limited to 'usr.bin/bsdiff/bspatch/bspatch.c')
-rw-r--r-- | usr.bin/bsdiff/bspatch/bspatch.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/usr.bin/bsdiff/bspatch/bspatch.c b/usr.bin/bsdiff/bspatch/bspatch.c index 92bc75b..5d61412 100644 --- a/usr.bin/bsdiff/bspatch/bspatch.c +++ b/usr.bin/bsdiff/bspatch/bspatch.c @@ -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) @@ -152,7 +161,7 @@ int main(int argc,char * argv[]) (cbz2err != BZ_STREAM_END))) errx(1, "Corrupt patch\n"); ctrl[i]=offtin(buf); - }; + } /* Sanity-check */ if ((ctrl[0] < 0) || (ctrl[1] < 0)) @@ -190,7 +199,7 @@ int main(int argc,char * argv[]) /* Adjust pointers */ newpos+=ctrl[1]; oldpos+=ctrl[2]; - }; + } /* Clean up the bzip2 reads */ BZ2_bzReadClose(&cbz2err, cpfbz2); |