Subject: bin/26535: missing options in the usage of bootptest(8)
To: None <gnats-bugs@gnats.NetBSD.org>
From: None <hira@po6.nsk.ne.jp>
List: netbsd-bugs
Date: 08/04/2004 00:21:52
>Number:         26535
>Category:       bin
>Synopsis:       missing options in the usage of bootptest(8)
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          open
>Class:          doc-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Aug 03 15:23:00 UTC 2004
>Closed-Date:
>Last-Modified:
>Originator:     Kouichirou Hiratsuka
>Release:        NetBSD 2.0G
>Organization:
>Environment:
System: NetBSD firefly.localdomain 2.0G NetBSD 2.0G (FIREFLY.MP) #40: Tue Aug 3 13:07:11 JST 2004 root@firefly.localdomain:/usr/src/sys/arch/i386/compile/FIREFLY.MP i386
Architecture: i386
Machine: i386
>Description:
	-f and -m are missing in the usage of bootptest(8).

% bootptest
bootptest: version 2.4.1
missing server name.
bootptest [-h] server-name [vendor-data-template-file]

>How-To-Repeat:
	bootptest

>Fix:
	* add -f and -m to usage
	* use getprogname()
	* print usage to stderr

Index: bootp/bootptest/bootptest.c
===================================================================
RCS file: /cvs/cvsroot/src/usr.sbin/bootp/bootptest/bootptest.c,v
retrieving revision 1.13
diff -u -r1.13 bootptest.c
--- bootp/bootptest/bootptest.c	14 Jul 2003 06:08:04 -0000	1.13
+++ bootp/bootptest/bootptest.c	3 Aug 2004 14:03:50 -0000
@@ -39,7 +39,8 @@
 __RCSID("$NetBSD: bootptest.c,v 1.13 2003/07/14 06:08:04 itojun Exp $");
 #endif
 
-char *usage = "bootptest [-h] server-name [vendor-data-template-file]";
+char *usage = "usage: %s [-f bootfile] [-h] [-m magic_number] server-name\n"
+	      "                 [vendor-data-template-file]\n";
 
 #include <sys/param.h>
 #include <sys/socket.h>
@@ -196,7 +197,7 @@
 
 		error:
 		default:
-			puts(usage);
+			(void)fprintf(stderr, usage, getprogname());
 			exit(1);
 
 		}
@@ -218,7 +219,7 @@
 	}
 	if (!servername) {
 		printf("missing server name.\n");
-		puts(usage);
+		(void)fprintf(stderr, usage, getprogname());
 		exit(1);
 	}
 	/*

>Release-Note:
>Audit-Trail:
>Unformatted: