From owner-svn-src-head@FreeBSD.ORG Wed Apr 23 14:05:29 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7F6FA3AF; Wed, 23 Apr 2014 14:05:29 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 528011A46; Wed, 23 Apr 2014 14:05:29 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s3NE5TTZ064347; Wed, 23 Apr 2014 14:05:29 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s3NE5SUL064345; Wed, 23 Apr 2014 14:05:28 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201404231405.s3NE5SUL064345@svn.freebsd.org> From: Ed Schouten Date: Wed, 23 Apr 2014 14:05:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r264823 - in head/usr.bin/bsdiff: bsdiff bspatch X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Apr 2014 14:05:29 -0000 Author: ed Date: Wed Apr 23 14:05:28 2014 New Revision: 264823 URL: http://svnweb.freebsd.org/changeset/base/264823 Log: 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. Modified: head/usr.bin/bsdiff/bsdiff/bsdiff.c head/usr.bin/bsdiff/bspatch/bspatch.c Modified: head/usr.bin/bsdiff/bsdiff/bsdiff.c ============================================================================== --- head/usr.bin/bsdiff/bsdiff/bsdiff.c Wed Apr 23 12:52:11 2014 (r264822) +++ head/usr.bin/bsdiff/bsdiff/bsdiff.c Wed Apr 23 14:05:28 2014 (r264823) @@ -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 */ Modified: head/usr.bin/bsdiff/bspatch/bspatch.c ============================================================================== --- head/usr.bin/bsdiff/bspatch/bspatch.c Wed Apr 23 12:52:11 2014 (r264822) +++ head/usr.bin/bsdiff/bspatch/bspatch.c Wed Apr 23 14:05:28 2014 (r264823) @@ -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)