OSDN Git Service

use gnulib's progname module
authorJim Meyering <meyering@redhat.com>
Thu, 5 Jun 2008 07:23:51 +0000 (09:23 +0200)
committerJim Meyering <meyering@redhat.com>
Thu, 5 Jun 2008 07:23:51 +0000 (09:23 +0200)
* bootstrap.conf (gnulib_modules): Add progname.
* debug/clearfat/clearfat.c: Include "progname.h".
(main): Call set_program_name rather than setting program_name.
* parted/parted.c: Likewise.
* partprobe/partprobe.c: Likewise.
* libparted/tests/disk.c: Include "progname.h" and call
set_program_name even though program_name isn't used, yet.
* libparted/tests/label.c: Likewise.

bootstrap.conf
debug/clearfat/clearfat.c
libparted/tests/disk.c
libparted/tests/label.c
parted/parted.c
partprobe/partprobe.c

index 351c6bd..c54fcea 100644 (file)
@@ -50,6 +50,7 @@ gnulib_modules="
        malloc
        realloc
        rpmatch
+       progname
        safe-read
        stdbool
        useless-if-before-free
index dd35798..7a4c61f 100644 (file)
@@ -1,6 +1,6 @@
 /*
     clear_fat - a tool to clear unused space (for testing purposes)
-    Copyright (C) 2000, 2007 Free Software Foundation, Inc.
+    Copyright (C) 2000, 2007-2008 Free Software Foundation, Inc.
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -26,6 +26,7 @@
 #include "configmake.h"
 #include "error.h"
 #include "long-options.h"
+#include "progname.h"
 
 #include "../../libparted/fs/fat/fat.h"
 
@@ -52,9 +53,6 @@
 #define AUTHORS \
   "<http://parted.alioth.debian.org/cgi-bin/trac.cgi/browser/AUTHORS>"
 
-/* The name this program was run with. */
-char *program_name;
-
 void
 usage (int status)
 {
@@ -267,7 +265,7 @@ main (int argc, char* argv[])
        PedPartition*           part;
        PedFileSystem*          fs;
 
-        program_name = argv[0];
+        set_program_name (argv[0]);
         setlocale (LC_ALL, "");
         bindtextdomain (PACKAGE, LOCALEDIR);
         textdomain (PACKAGE);
index 020bdc0..cf69b00 100644 (file)
@@ -6,6 +6,7 @@
 #include <parted/parted.h>
 
 #include "common.h"
+#include "progname.h"
 
 static char* temporary_disk;
 
@@ -87,6 +88,7 @@ END_TEST
 int
 main (void)
 {
+        set_program_name (argv[0]);
         int number_failed;
         Suite* suite = suite_create ("Disk");
         TCase* tcase_duplicate = tcase_create ("Duplicate");
index 54f40c3..aa825f9 100644 (file)
@@ -6,6 +6,7 @@
 #include <parted/parted.h>
 
 #include "common.h"
+#include "progname.h"
 
 static char* temporary_disk;
 
@@ -149,6 +150,7 @@ END_TEST
 int
 main (void)
 {
+        set_program_name (argv[0]);
         int number_failed;
         Suite* suite = suite_create ("Disk Label");
         TCase* tcase_basic = tcase_create ("Create");
index 4af72ac..9f79ea4 100644 (file)
@@ -24,6 +24,7 @@
 #include "version-etc.h"
 #include "command.h"
 #include "ui.h"
+#include "progname.h"
 #include "table.h"
 
 #define AUTHORS \
@@ -99,8 +100,6 @@ static const char *const options_help [][2] = {
         {NULL,          NULL}
 };
 
-char *program_name;
-
 int     opt_script_mode = 0;
 int     pretend_input_tty = 0;
 int     opt_machine_mode = 0;
@@ -2470,7 +2469,7 @@ main (int argc, char** argv)
         PedDevice*      dev;
         int             status;
 
-        program_name = argv[0];
+        set_program_name (argv[0]);
         atexit (close_stdout);
 
         dev = _init (&argc, &argv);
index d324167..75f7399 100644 (file)
@@ -1,6 +1,6 @@
 /*
     partprobe - informs the OS kernel of partition layout
-    Copyright (C) 2001, 2002, 2007 Free Software Foundation, Inc.
+    Copyright (C) 2001, 2002, 2007-2008 Free Software Foundation, Inc.
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -34,6 +34,7 @@
 
 #include "closeout.h"
 #include "configmake.h"
+#include "progname.h"
 #include "version-etc.h"
 
 #include <locale.h>
@@ -66,9 +67,6 @@ static struct option const long_options[] =
     {NULL, 0, NULL, 0}
   };
 
-
-char *program_name;
-
 /* initialized to 0 according to the language lawyers */
 static int     opt_no_inform;
 static int     opt_summary;
@@ -163,7 +161,7 @@ main (int argc, char* argv[])
 {
        int             status = 0;
 
-       program_name = argv[0];
+       set_program_name (argv[0]);
 
        setlocale (LC_ALL, "");
        bindtextdomain (PACKAGE, LOCALEDIR);