File mtools-4.0.10-help-flag.diff of Package mtools

diff -upr mtools-4.0.10/mattrib.c mtools-4.0.10.new/mattrib.c
--- mtools-4.0.10/mattrib.c	2009-03-03 07:10:13.000000000 +0100
+++ mtools-4.0.10.new/mattrib.c	2009-10-23 09:07:45.000000000 +0200
@@ -168,6 +168,7 @@ void mattrib(int argc, char **argv, int
 	int concise;
 	int replay;
 	char *ptr;
+        int wantUsage;
 
 	arg.add = 0;
 	arg.remove = 0xff;
@@ -176,11 +177,16 @@ void mattrib(int argc, char **argv, int
 	view = 0;
 	concise = 0;
 	replay = 0;
+
+        wantUsage = 0;
 	
 	if(helpFlag(argc, argv))
 		usage(0);
-	while ((c = getopt(argc, argv, "i:/ahrsAHRSXph")) != EOF) {
+	while ((c = getopt(argc, argv, "i:/ahrsAHRSXp")) != EOF) {
 		switch (c) {
+                        case 'h':
+                                wantUsage = 1;
+                                /* FALL TROUGH */
 			default:
 				arg.remove &= ~letterToCode(c);
 				break;
@@ -196,13 +202,15 @@ void mattrib(int argc, char **argv, int
 			case 'X':
 				concise = 1;
 				break;
-			case 'h':
-				usage(0);
 			case '?':
 				usage(1);
 		}
 	}
 
+        if(optind == argc && wantUsage) {
+                usage(0);
+        }
+
 	for(;optind < argc;optind++) {
 		switch(argv[optind][0]) {
 			case '+':
openSUSE Build Service is sponsored by