Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-1-5]: src/usr.bin/at Pull up rev 1.15:
details: https://anonhg.NetBSD.org/src/rev/b7f41c927265
branches: netbsd-1-5
changeset: 488262:b7f41c927265
user: simonb <simonb%NetBSD.org@localhost>
date: Mon Jun 26 00:40:38 2000 +0000
description:
Pull up rev 1.15:
Use LOGIN_NAME_MAX for checking username length, not something based
on UT_NAMESIZE, also saves a call to getpwnam() and getpwuid() in
most cases. Size columns correctly so output of atq lines up neatly.
Mostly de-lint.
Fixes PR bin/1489 from David Gilbert, among other things.
diffstat:
usr.bin/at/at.c | 36 +++++++++++++++++-------------------
1 files changed, 17 insertions(+), 19 deletions(-)
diffs (117 lines):
diff -r ce550a8c567e -r b7f41c927265 usr.bin/at/at.c
--- a/usr.bin/at/at.c Mon Jun 26 00:38:45 2000 +0000
+++ b/usr.bin/at/at.c Mon Jun 26 00:40:38 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: at.c,v 1.14 2000/04/23 18:11:21 mjl Exp $ */
+/* $NetBSD: at.c,v 1.14.4.1 2000/06/26 00:40:38 simonb Exp $ */
/*
* at.c : Put file into atrun queue
@@ -48,12 +48,6 @@
#include <utmp.h>
#include <locale.h>
-#if (MAXLOGNAME-1) > UT_NAMESIZE
-#define LOGNAMESIZE UT_NAMESIZE
-#else
-#define LOGNAMESIZE (MAXLOGNAME-1)
-#endif
-
/* Local headers */
#include "at.h"
#include "panic.h"
@@ -75,7 +69,7 @@
#if 0
static char rcsid[] = "$OpenBSD: at.c,v 1.15 1998/06/03 16:20:26 deraadt Exp $";
#else
-__RCSID("$NetBSD: at.c,v 1.14 2000/04/23 18:11:21 mjl Exp $");
+__RCSID("$NetBSD: at.c,v 1.14.4.1 2000/06/26 00:40:38 simonb Exp $");
#endif
#endif
@@ -110,6 +104,7 @@
/* Signal catching functions */
+/*ARGSUSED*/
static void
sigc(signo)
int signo;
@@ -124,6 +119,7 @@
exit(EXIT_FAILURE);
}
+/*ARGSUSED*/
static void
alarmc(signo)
int signo;
@@ -295,7 +291,7 @@
mailname = getenv("USER");
if ((mailname == NULL) || (mailname[0] == '\0') ||
- (strlen(mailname) > LOGNAMESIZE) || (getpwnam(mailname) == NULL)) {
+ (strlen(mailname) > LOGIN_NAME_MAX) || (getpwnam(mailname) == NULL)) {
pass_entry = getpwuid(real_uid);
if (pass_entry != NULL)
mailname = pass_entry->pw_name;
@@ -306,8 +302,8 @@
if (fpin == NULL)
perr("Cannot open input file");
}
- (void)fprintf(fp, "#!/bin/sh\n# atrun uid=%u gid=%u\n# mail %*s %d\n",
- real_uid, real_gid, LOGNAMESIZE, mailname, send_mail);
+ (void)fprintf(fp, "#!/bin/sh\n# atrun uid=%u gid=%u\n# mail %s %d\n",
+ real_uid, real_gid, mailname, send_mail);
/* Write out the umask at the time of invocation */
(void)fprintf(fp, "umask %o\n", cmask);
@@ -371,7 +367,7 @@
(void)fputs("cd ", fp);
for (ap = cwdname(); *ap != '\0'; ap++) {
if (*ap == '\n')
- fprintf(fp, "\"\n\"");
+ (void)fprintf(fp, "\"\n\"");
else {
if (*ap != '/' && !isalnum(*ap))
(void)fputc('\\', fp);
@@ -467,16 +463,20 @@
runtime = *localtime(&runtimer);
strftime(timestr, TIMESIZE, "%X %x", &runtime);
if (first) {
- (void)printf("Date\t\t\tOwner\tQueue\tJob#\n");
+ (void)printf("%-*s %-*s %-*s %s\n",
+ (int)strlen(timestr), "Date",
+ LOGIN_NAME_MAX, "Owner",
+ 7, "Queue",
+ "Job");
first = 0;
}
pw = getpwuid(buf.st_uid);
- (void)printf("%s\t%s\t%c%s\t%d\n",
+ (void)printf("%s %-*s %c%-*s %d\n",
timestr,
- pw ? pw->pw_name : "???",
+ LOGIN_NAME_MAX, pw ? pw->pw_name : "???",
queue,
- (S_IXUSR & buf.st_mode) ? "" : "(done)",
+ 6, (S_IXUSR & buf.st_mode) ? "" : "(done)",
jobno);
}
PRIV_END
@@ -579,9 +579,6 @@
char queue_set = 0;
char *pgm;
- enum {
- ATQ, ATRM, AT, BATCH, CAT
- }; /* what program we want to run */
int program = AT; /* our default program */
char *options = "q:f:mvldbrVc"; /* default options for at */
int disp_version = 0;
@@ -733,4 +730,5 @@
break;
}
exit(EXIT_SUCCESS);
+ /*NOTREACHED*/
}
Home |
Main Index |
Thread Index |
Old Index