summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2015-11-06 23:47:43 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2015-11-06 23:47:43 +0000
commitacfe0a6f79f135c701e5b2ce57db63a0703470e7 (patch)
treee1e552b8d9092f76782133d03790effc893470d2 /usr.bin
parentdb543bd70b34173b3acc9da3ce200f0e56d76183 (diff)
Use __progname instead of the homegrown ProgramName.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/at/at.c25
-rw-r--r--usr.bin/at/parsetime.c16
2 files changed, 17 insertions, 24 deletions
diff --git a/usr.bin/at/at.c b/usr.bin/at/at.c
index 77499b8f404..9b607723420 100644
--- a/usr.bin/at/at.c
+++ b/usr.bin/at/at.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: at.c,v 1.68 2015/11/04 20:28:17 millert Exp $ */
+/* $OpenBSD: at.c,v 1.69 2015/11/06 23:47:42 millert Exp $ */
/*
* at.c : Put file into atrun queue
@@ -31,8 +31,6 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#define MAIN_PROGRAM
-
#include <sys/types.h>
#include <sys/stat.h>
@@ -100,7 +98,7 @@ time_t parsetime(int, char **);
static __dead void
panic(const char *a)
{
- (void)fprintf(stderr, "%s: %s\n", ProgramName, a);
+ (void)fprintf(stderr, "%s: %s\n", __progname, a);
if (fcreated)
unlink(atfile);
@@ -113,7 +111,7 @@ panic(const char *a)
static __dead void
panic2(const char *a, const char *b)
{
- (void)fprintf(stderr, "%s: %s%s\n", ProgramName, a, b);
+ (void)fprintf(stderr, "%s: %s%s\n", __progname, a, b);
if (fcreated)
unlink(atfile);
@@ -498,7 +496,7 @@ list_jobs(int argc, char **argv, int count_only, int csort)
} else
uids = NULL;
- shortformat = strcmp(ProgramName, "at") == 0;
+ shortformat = strcmp(__progname, "at") == 0;
if (chdir(AT_DIR) != 0)
perr2("Cannot change to ", AT_DIR);
@@ -660,7 +658,7 @@ process_jobs(int argc, char **argv, int what)
if (user_uid != pw->pw_uid && user_uid != 0) {
fprintf(stderr, "%s: Only the superuser"
" may %s other users' jobs\n",
- ProgramName, what == ATRM
+ __progname, what == ATRM
? "remove" : "view");
exit(EXIT_FAILURE);
}
@@ -745,7 +743,7 @@ process_jobs(int argc, char **argv, int what)
if (jobs[i] != NULL) {
if (!force)
fprintf(stderr, "%s: %s: no such job\n",
- ProgramName, jobs[i]);
+ __progname, jobs[i]);
error++;
}
}
@@ -908,23 +906,18 @@ main(int argc, char **argv)
if (argc < 1)
usage();
- if ((ProgramName = strrchr(argv[0], '/')) != NULL)
- ProgramName++;
- else
- ProgramName = argv[0];
-
user_uid = getuid();
user_gid = getgid();
spool_gid = getegid();
/* find out what this program is supposed to do */
- if (strcmp(ProgramName, "atq") == 0) {
+ if (strcmp(__progname, "atq") == 0) {
program = ATQ;
options = "cnvq:";
- } else if (strcmp(ProgramName, "atrm") == 0) {
+ } else if (strcmp(__progname, "atrm") == 0) {
program = ATRM;
options = "afi";
- } else if (strcmp(ProgramName, "batch") == 0) {
+ } else if (strcmp(__progname, "batch") == 0) {
program = BATCH;
options = "f:q:mv";
}
diff --git a/usr.bin/at/parsetime.c b/usr.bin/at/parsetime.c
index b01a6c81632..121041c2b14 100644
--- a/usr.bin/at/parsetime.c
+++ b/usr.bin/at/parsetime.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: parsetime.c,v 1.23 2015/08/20 22:32:41 deraadt Exp $ */
+/* $OpenBSD: parsetime.c,v 1.24 2015/11/06 23:47:42 millert Exp $ */
/*
* parsetime.c - parse time for at(1)
@@ -182,7 +182,7 @@ init_scanner(int argc, char **argv)
if ((sc_token = malloc(sc_len)) == NULL) {
fprintf(stderr, "%s: Insufficient virtual memory\n",
- ProgramName);
+ __progname);
return (-1);
}
return (0);
@@ -264,7 +264,7 @@ token(void)
static void
plonk(int tok)
{
- fprintf(stderr, "%s: %s time\n", ProgramName,
+ fprintf(stderr, "%s: %s time\n", __progname,
(tok == EOF) ? "incomplete" : "garbled");
}
@@ -368,7 +368,7 @@ plus(struct tm *tm)
case MINUTES:
if (expectplur != sc_tokplur)
fprintf(stderr, "%s: pluralization is wrong\n",
- ProgramName);
+ __progname);
dateadd(increment, tm);
return (0);
}
@@ -446,7 +446,7 @@ tod(struct tm *tm)
}
return (0);
bad:
- fprintf(stderr, "%s: garbled time\n", ProgramName);
+ fprintf(stderr, "%s: garbled time\n", __progname);
return (-1);
}
@@ -607,7 +607,7 @@ month(struct tm *tm)
}
return (0);
bad:
- fprintf(stderr, "%s: garbled time\n", ProgramName);
+ fprintf(stderr, "%s: garbled time\n", __progname);
return (-1);
}
@@ -700,13 +700,13 @@ parsetime(int argc, char **argv)
}
if (runtimer < 0) {
- fprintf(stderr, "%s: garbled time\n", ProgramName);
+ fprintf(stderr, "%s: garbled time\n", __progname);
return (-1);
}
if (nowtimer > runtimer) {
fprintf(stderr, "%s: cannot schedule jobs in the past\n",
- ProgramName);
+ __progname);
return (-1);
}