Module Name:    src
Committed By:   christos
Date:           Wed Dec  2 04:17:25 UTC 2015

Modified Files:
        src/sbin/gpt: gpt.c

Log Message:
print the old and the new style usage.


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 src/sbin/gpt/gpt.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sbin/gpt/gpt.c
diff -u src/sbin/gpt/gpt.c:1.53 src/sbin/gpt/gpt.c:1.54
--- src/sbin/gpt/gpt.c:1.53	Tue Dec  1 23:07:11 2015
+++ src/sbin/gpt/gpt.c	Tue Dec  1 23:17:25 2015
@@ -35,7 +35,7 @@
 __FBSDID("$FreeBSD: src/sbin/gpt/gpt.c,v 1.16 2006/07/07 02:44:23 marcel Exp $");
 #endif
 #ifdef __RCSID
-__RCSID("$NetBSD: gpt.c,v 1.53 2015/12/02 04:07:11 christos Exp $");
+__RCSID("$NetBSD: gpt.c,v 1.54 2015/12/02 04:17:25 christos Exp $");
 #endif
 
 #include <sys/param.h>
@@ -741,11 +741,21 @@ gpt_usage(const char *prefix, const stru
 
 	if (prefix == NULL) {
 		const char *pname = getprogname();
+		const char *d1, *d2, *d = " <device>";
 		int len = (int)strlen(pname);
-		fprintf(stderr, "Usage: %s %s %s\n", pname, cmd->name, a[0]);
+		if (strcmp(pname, "gpt") == 0) {
+			d1 = "";
+			d2 = d;
+		} else {
+			d2 = "";
+			d1 = d;
+		}
+		fprintf(stderr, "Usage: %s%s %s %s%s\n", pname, 
+		    d1, cmd->name, a[0], d2);
 		for (i = 1; i < hlen; i++) {
 			fprintf(stderr,
-			    "       %*s %s %s\n", len, "", cmd->name, a[i]);
+			    "       %*s%s %s %s%s\n", len, "",
+			    d1, cmd->name, a[i], d2);
 		}
 	} else {
 		for (i = 0; i < hlen; i++)

Reply via email to