[PATCH] use __progname in mkreiserfs.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Jeff,

I have a patch for mkreiserfs.c...

* We don't need to derive program_name from argv;
  __progname already exists for this purpose.

Does this look ok? 

- Michael


--- mkreiserfs.c	Thu Nov 15 14:34:11 2012
+++ mkreiserfs_new.c	Thu Nov 15 14:40:07 2012
@@ -34,9 +34,8 @@
 #  include <uuid/uuid.h>
 #endif
 
+extern char *__progname;
 
-char *program_name;
-
 static void message( const char * fmt, ... ) 
 	__attribute__ ((format (printf, 1, 2)));
 
@@ -50,7 +49,7 @@
     va_end( args );
 
     if( buf ) {
-	    fprintf( stderr, "%s: %s\n", program_name, buf );
+	    fprintf( stderr, "%s: %s\n", ame, buf );
 	    free( buf );
     }
 }
@@ -80,7 +79,7 @@
 	"                                   by end users only.\n"
 	"  -d | --debug                     print debugging information during mkreiser\n"
 	"  -V                               print version and exit\n",
-	program_name);
+	__progname);
     exit (1);
 }
 
@@ -432,7 +431,7 @@
     
     if (*tmp) {
 	reiserfs_exit (1, "%s: strtol is unable to make an integer of %s\n",
-		       program_name, str);
+		       __progname, str);
     }
     
     return val;
@@ -447,7 +446,7 @@
 
     if (*tmp) {
 	reiserfs_exit (1, "%s: strtoll is unable to make an integer of %s\n",
-		       program_name, str);
+		       __progname, str);
     }
 
     return val;
@@ -461,7 +460,7 @@
     if (!is_blocksize_correct (*b_size))
         reiserfs_exit (1, "%s: wrong blocksize %s specified, "
 		       "only power of 2 from 512-8192 interval "
-		       "are supported", program_name, str);
+		       "are supported", __progname, str);
 }
 
 
@@ -478,7 +477,7 @@
 /*
     if (Journal_size < JOURNAL_MIN_SIZE)
 		die ("%s: wrong journal size specified: %lu. Should be at least %u",
-			 program_name, 
+			 __progname, 
 			 Journal_size + 1, JOURNAL_MIN_SIZE + 1);
 */
 }
@@ -560,13 +559,6 @@
     int c;
     static int flag;
 
-    program_name = strrchr( argv[ 0 ], '/' );
-    
-    if (program_name)
-	program_name++;
-    else
-	program_name = argv[ 0 ];
-    
     if (argc < 2)
 	print_usage_and_exit ();
     
@@ -673,7 +665,7 @@
 		}
     }
 
-    print_banner (program_name);
+    print_banner (__progname);
 
     if (mode & QUIET_MODE)
 	fclose(stdout);
--
To unsubscribe from this list: send the line "unsubscribe reiserfs-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux File System Development]     [Linux BTRFS]     [Linux NFS]     [Linux Filesystems]     [Ext4 Filesystem]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Resources]

  Powered by Linux