reiserfs-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Michael W. Bombardieri" <mb@ii.net>
To: Jeff Mahoney <jeffm@suse.com>
Cc: reiserfs-devel@vger.kernel.org
Subject: [PATCH] use __progname in mkreiserfs.c (try again)
Date: Thu, 15 Nov 2012 14:55:01 +0800	[thread overview]
Message-ID: <20121115065501.GA22342@bom.nom.co> (raw)

Sorry for the re-post.

I think I mangled the previous diff in vi...

--- 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", __progname, 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);

                 reply	other threads:[~2012-11-15  6:55 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20121115065501.GA22342@bom.nom.co \
    --to=mb@ii.net \
    --cc=jeffm@suse.com \
    --cc=reiserfs-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).