[PATCH] use gnulib's progname module
Jim Meyering
meyering at redhat.com
Thu Jun 5 07:23:51 UTC 2008
* 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 | 1 +
debug/clearfat/clearfat.c | 8 +++-----
libparted/tests/disk.c | 2 ++
libparted/tests/label.c | 2 ++
parted/parted.c | 5 ++---
partprobe/partprobe.c | 8 +++-----
6 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/bootstrap.conf b/bootstrap.conf
index 351c6bd..c54fcea 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -50,6 +50,7 @@ gnulib_modules="
malloc
realloc
rpmatch
+ progname
safe-read
stdbool
useless-if-before-free
diff --git a/debug/clearfat/clearfat.c b/debug/clearfat/clearfat.c
index dd35798..7a4c61f 100644
--- a/debug/clearfat/clearfat.c
+++ b/debug/clearfat/clearfat.c
@@ -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);
diff --git a/libparted/tests/disk.c b/libparted/tests/disk.c
index 020bdc0..cf69b00 100644
--- a/libparted/tests/disk.c
+++ b/libparted/tests/disk.c
@@ -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");
diff --git a/libparted/tests/label.c b/libparted/tests/label.c
index 54f40c3..aa825f9 100644
--- a/libparted/tests/label.c
+++ b/libparted/tests/label.c
@@ -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");
diff --git a/parted/parted.c b/parted/parted.c
index 4af72ac..9f79ea4 100644
--- a/parted/parted.c
+++ b/parted/parted.c
@@ -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);
diff --git a/partprobe/partprobe.c b/partprobe/partprobe.c
index d324167..75f7399 100644
--- a/partprobe/partprobe.c
+++ b/partprobe/partprobe.c
@@ -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);
--
1.5.6.rc0.30.g7c3f3
More information about the parted-devel
mailing list