From 10234848d588839bb6f9394d46a919e69976127d Mon Sep 17 00:00:00 2001 From: obrien Date: Sun, 11 May 2008 17:23:57 +0000 Subject: Better to just statically set the name vs. determine at run time. --- usr.sbin/sade/config.c | 2 +- usr.sbin/sade/label.c | 2 +- usr.sbin/sade/main.c | 1 + usr.sbin/sade/sade.h | 1 + usr.sbin/sade/system.c | 4 ++-- usr.sbin/sade/variable.c | 4 ++-- usr.sbin/sysinstall/config.c | 2 +- usr.sbin/sysinstall/label.c | 2 +- usr.sbin/sysinstall/main.c | 1 + usr.sbin/sysinstall/sysinstall.h | 1 + usr.sbin/sysinstall/system.c | 4 ++-- usr.sbin/sysinstall/variable.c | 4 ++-- 12 files changed, 16 insertions(+), 12 deletions(-) diff --git a/usr.sbin/sade/config.c b/usr.sbin/sade/config.c index b4f755f..c8b0fc8 100644 --- a/usr.sbin/sade/config.c +++ b/usr.sbin/sade/config.c @@ -182,7 +182,7 @@ configFstab(dialogMenuItem *self) else { msgConfirm("Attempting to rebuild your /etc/fstab file. Warning: If you had\n" "any CD devices in use before running %s then they may NOT\n" - "be found by this run!", StartName); + "be found by this run!", ProgName); } devs = deviceFind(NULL, DEVICE_TYPE_DISK); diff --git a/usr.sbin/sade/label.c b/usr.sbin/sade/label.c index 6b7c774..3f20450 100644 --- a/usr.sbin/sade/label.c +++ b/usr.sbin/sade/label.c @@ -1276,7 +1276,7 @@ diskLabel(Device *dev) if (!variable_cmp(DISK_LABELLED, "written")) { msgConfirm("You've already written out your changes - if you\n" "wish to overwrite them, you'll have to restart\n" - "%s first.", StartName); + "%s first.", ProgName); } else if (!msgNoYes("WARNING: You are about to modify an EXISTING\n" "installation.\n\n" diff --git a/usr.sbin/sade/main.c b/usr.sbin/sade/main.c index 5496e13..22d9401 100644 --- a/usr.sbin/sade/main.c +++ b/usr.sbin/sade/main.c @@ -34,6 +34,7 @@ #include const char *StartName; /* Initial contents of argv[0] */ +const char *ProgName = "sade"; int main(int argc, char **argv) diff --git a/usr.sbin/sade/sade.h b/usr.sbin/sade/sade.h index 66ba396..4bf7e1b 100644 --- a/usr.sbin/sade/sade.h +++ b/usr.sbin/sade/sade.h @@ -278,6 +278,7 @@ extern DMenu MenuMBRType; /* Type of MBR to write on the disk */ extern DMenu MenuMain; /* New main menu */ extern DMenu MenuDiskDevices; /* Disk type devices */ extern const char * StartName; /* Which name we were started as */ +extern const char * ProgName; /* Program's proper name */ /* Important chunks. */ extern Chunk *HomeChunk; diff --git a/usr.sbin/sade/system.c b/usr.sbin/sade/system.c index 05e55ec..149bbeb 100644 --- a/usr.sbin/sade/system.c +++ b/usr.sbin/sade/system.c @@ -233,11 +233,11 @@ systemHelpFile(char *file, char *buf) snprintf(buf, FILENAME_MAX, "/stand/help/%s.TXT", file); if (file_readable(buf)) return expand(buf); - snprintf(buf, FILENAME_MAX, "/usr/src/usr.sbin/%s/help/%s.hlp", StartName, + snprintf(buf, FILENAME_MAX, "/usr/src/usr.sbin/%s/help/%s.hlp", ProgName, file); if (file_readable(buf)) return buf; - snprintf(buf, FILENAME_MAX, "/usr/src/usr.sbin/%s/help/%s.TXT", StartName, + snprintf(buf, FILENAME_MAX, "/usr/src/usr.sbin/%s/help/%s.TXT", ProgName, file); if (file_readable(buf)) return buf; diff --git a/usr.sbin/sade/variable.c b/usr.sbin/sade/variable.c index 9abbcf4..911eb02 100644 --- a/usr.sbin/sade/variable.c +++ b/usr.sbin/sade/variable.c @@ -238,12 +238,12 @@ dump_variables(dialogMenuItem *unused) Variable *vp; if (isDebug()) - msgDebug("Writing %s variables to file..\n", StartName); + msgDebug("Writing %s variables to file..\n", ProgName); fp = fopen("/etc/sade.vars", "w"); if (!fp) { msgConfirm("Unable to write to /etc/%s.vars: %s", - StartName, strerror(errno)); + ProgName, strerror(errno)); return DITEM_FAILURE; } diff --git a/usr.sbin/sysinstall/config.c b/usr.sbin/sysinstall/config.c index b101149..bb7ffbc 100644 --- a/usr.sbin/sysinstall/config.c +++ b/usr.sbin/sysinstall/config.c @@ -188,7 +188,7 @@ configFstab(dialogMenuItem *self) else { msgConfirm("Attempting to rebuild your /etc/fstab file. Warning: If you had\n" "any CD devices in use before running %s then they may NOT\n" - "be found by this run!", StartName); + "be found by this run!", ProgName); } } diff --git a/usr.sbin/sysinstall/label.c b/usr.sbin/sysinstall/label.c index 3119515..a60c8dc 100644 --- a/usr.sbin/sysinstall/label.c +++ b/usr.sbin/sysinstall/label.c @@ -1281,7 +1281,7 @@ diskLabel(Device *dev) if (!variable_cmp(DISK_LABELLED, "written")) { msgConfirm("You've already written out your changes - if you\n" "wish to overwrite them, you'll have to restart\n" - "%s first.", StartName); + "%s first.", ProgName); } else if (!msgNoYes("WARNING: This should only be used when modifying an EXISTING\n" "installation. If you are installing FreeBSD for the first time\n" diff --git a/usr.sbin/sysinstall/main.c b/usr.sbin/sysinstall/main.c index dc02902..abea76c 100644 --- a/usr.sbin/sysinstall/main.c +++ b/usr.sbin/sysinstall/main.c @@ -41,6 +41,7 @@ #include const char *StartName; /* Initial contents of argv[0] */ +const char *ProgName = "sysinstall"; static void screech(int sig) diff --git a/usr.sbin/sysinstall/sysinstall.h b/usr.sbin/sysinstall/sysinstall.h index 64ee7a7..2805c87 100644 --- a/usr.sbin/sysinstall/sysinstall.h +++ b/usr.sbin/sysinstall/sysinstall.h @@ -479,6 +479,7 @@ extern DMenu MenuUsermgmt; /* User management menu */ extern DMenu MenuFixit; /* Fixit floppy/CDROM/shell menu */ extern int FixItMode; /* FixItMode starts shell on current device (ie Serial port) */ extern const char * StartName; /* Which name we were started as */ +extern const char * ProgName; /* Program's proper name */ extern int NCpus; /* # cpus on machine */ /* Important chunks. */ diff --git a/usr.sbin/sysinstall/system.c b/usr.sbin/sysinstall/system.c index ad5ab20..a5d8aa9 100644 --- a/usr.sbin/sysinstall/system.c +++ b/usr.sbin/sysinstall/system.c @@ -365,11 +365,11 @@ systemHelpFile(char *file, char *buf) snprintf(buf, FILENAME_MAX, "/stand/help/%s.TXT", file); if (file_readable(buf)) return expand(buf); - snprintf(buf, FILENAME_MAX, "/usr/src/usr.sbin/%s/help/%s.hlp", StartName, + snprintf(buf, FILENAME_MAX, "/usr/src/usr.sbin/%s/help/%s.hlp", ProgName, file); if (file_readable(buf)) return buf; - snprintf(buf, FILENAME_MAX, "/usr/src/usr.sbin/%s/help/%s.TXT", StartName, + snprintf(buf, FILENAME_MAX, "/usr/src/usr.sbin/%s/help/%s.TXT", ProgName, file); if (file_readable(buf)) return buf; diff --git a/usr.sbin/sysinstall/variable.c b/usr.sbin/sysinstall/variable.c index ba6ca9f..3bc6aa7 100644 --- a/usr.sbin/sysinstall/variable.c +++ b/usr.sbin/sysinstall/variable.c @@ -243,12 +243,12 @@ dump_variables(dialogMenuItem *unused) Variable *vp; if (isDebug()) - msgDebug("Writing %s variables to file..\n", StartName); + msgDebug("Writing %s variables to file..\n", ProgName); fp = fopen("/etc/sysinstall.vars", "w"); if (!fp) { msgConfirm("Unable to write to /etc/%s.vars: %s", - StartName, strerror(errno)); + ProgName, strerror(errno)); return DITEM_FAILURE; } -- cgit v1.1