summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormillert <millert@openbsd.org>2002-05-13 16:12:07 +0000
committermillert <millert@openbsd.org>2002-05-13 16:12:07 +0000
commit568aba8959219ed4bdfcdbde50bafa93e1b1704a (patch)
treee8256a361ff055d06d1f713942ddd82a839eb5e3
parentCall setsid() in the child after sshd accepts the connection and forks. (diff)
downloadwireguard-openbsd-568aba8959219ed4bdfcdbde50bafa93e1b1704a.tar.xz
wireguard-openbsd-568aba8959219ed4bdfcdbde50bafa93e1b1704a.zip
Only print usage for the command that was run (at, atq, atrm, batch), not
all four. Also differentiate between the touch(1) style time as time_arg and the at(1) style time as timespec (which is what SUS3 does). Instead of referring to the touch time format as POSIX time, reference touch. This is what SUS3 does and it is what users will know.
-rw-r--r--usr.bin/at/at.122
-rw-r--r--usr.bin/at/at.c10
-rw-r--r--usr.bin/at/at.h5
-rw-r--r--usr.bin/at/panic.c30
4 files changed, 42 insertions, 25 deletions
diff --git a/usr.bin/at/at.1 b/usr.bin/at/at.1
index a7f4eb864d5..0bbaec937f1 100644
--- a/usr.bin/at/at.1
+++ b/usr.bin/at/at.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: at.1,v 1.22 2002/05/11 23:02:33 millert Exp $
+.\" $OpenBSD: at.1,v 1.23 2002/05/13 16:12:07 millert Exp $
.\" $FreeBSD: at.man,v 1.6 1997/02/22 19:54:05 peter Exp $
.Dd April 12, 1995
.Dt AT 1
@@ -14,12 +14,12 @@
.Op Fl blmrv
.Op Fl f Ar file
.Op Fl q Ar queue
-.Fl t Ar [[CC]YY]MMDDhhmm[.SS]
+.Fl t Ar time_arg
.Nm at
.Op Fl blmrv
.Op Fl f Ar file
.Op Fl q Ar queue
-.Ar time
+.Ar timespec
.Nm at
.Fl c Ar job Op Ar job ...
.Nm atq
@@ -32,7 +32,7 @@
.Op Fl mv
.Op Fl f Ar file
.Op Fl q Ar queue
-.Op Ar time
+.Op Ar timespec
.Sh DESCRIPTION
.Nm at
and
@@ -102,13 +102,14 @@ is given a specific queue, it will only show jobs pending in that queue.
.It Fl r
An alias for
.Nm atrm .
-.It Fl t
-Specify the job time using the \*[Px] time format.
+.It Fl t Ar time_arg
+Specify the job time using the format specified by
+.Xr touch 1 .
The argument should be in the form
.Ar [[CC]YY]MMDDhhmm[.SS]
where each pair of letters represents the following:
.Pp
-.Bl -tag -width indent -compact -offset indent
+.Bl -tag -width Ds -compact -offset indent
.It Ar CC
The first two digits of the year (the century).
.It Ar YY
@@ -143,7 +144,7 @@ Otherwise shows the time the job will be executed.
.Pp
.Nm at
allows some moderately complex
-.Ar time
+.Ar timespec
specifications.
It accepts times of the form
.Ar HHMM
@@ -209,7 +210,9 @@ To run a job at 1am tomorrow, you would do
.Pp
The
.Nm at
-utility also supports the \*[Px] time format (see the
+utility also supports the time format used by
+.Xr touch 1
+(see the
.Fl t
option).
.Pp
@@ -290,6 +293,7 @@ job sequence file
.Sh SEE ALSO
.Xr nice 1 ,
.Xr sh 1 ,
+.Xr touch 1 ,
.Xr umask 2 ,
.Xr atrun 8 ,
.Xr cron 8 ,
diff --git a/usr.bin/at/at.c b/usr.bin/at/at.c
index 2ecbbb21eb7..43b99e14f68 100644
--- a/usr.bin/at/at.c
+++ b/usr.bin/at/at.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: at.c,v 1.26 2002/05/11 23:16:44 millert Exp $ */
+/* $OpenBSD: at.c,v 1.27 2002/05/13 16:12:07 millert Exp $ */
/* $NetBSD: at.c,v 1.4 1995/03/25 18:13:31 glass Exp $ */
/*
@@ -69,11 +69,9 @@
#define TIMESIZE 50
-enum { ATQ, ATRM, AT, BATCH, CAT }; /* what program we want to run */
-
/* File scope variables */
#ifndef lint
-static const char rcsid[] = "$OpenBSD: at.c,v 1.26 2002/05/11 23:16:44 millert Exp $";
+static const char rcsid[] = "$OpenBSD: at.c,v 1.27 2002/05/13 16:12:07 millert Exp $";
#endif
char *no_export[] =
@@ -86,6 +84,7 @@ static int send_mail = 0;
extern char **environ;
int fcreated;
+int program = AT; /* default program mode */
char atfile[FILENAME_MAX];
char *atinput = (char *)0; /* where to get input from */
@@ -452,7 +451,7 @@ list_jobs(void)
runtimer = 60 * (time_t) ctm;
runtime = *localtime(&runtimer);
- strftime(timestr, TIMESIZE, "%+", &runtime);
+ strftime(timestr, TIMESIZE, "%a %b %e %T %Y", &runtime);
if (first) {
(void)printf("Date\t\t\t\tOwner\t\tQueue\tJob#\n");
first = 0;
@@ -627,7 +626,6 @@ main(int argc, char **argv)
int c;
char queue = DEFAULT_AT_QUEUE;
char queue_set = 0;
- int program = AT; /* default program mode */
char *options = "q:f:t:bcdlmrv"; /* default options for at */
time_t timer;
int tflag = 0;
diff --git a/usr.bin/at/at.h b/usr.bin/at/at.h
index 59ba634cf99..660a41af0ca 100644
--- a/usr.bin/at/at.h
+++ b/usr.bin/at/at.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: at.h,v 1.5 2002/05/11 23:16:44 millert Exp $ */
+/* $OpenBSD: at.h,v 1.6 2002/05/13 16:12:07 millert Exp $ */
/* $NetBSD: at.h,v 1.2 1995/03/25 18:13:32 glass Exp $ */
/*
@@ -28,9 +28,12 @@
extern int fcreated;
extern char *__progname;
+extern int program;
extern char atfile[];
extern char atverify;
+enum { ATQ, ATRM, AT, BATCH, CAT }; /* what are we running as? */
+
#define AT_MAXJOBS 255 /* max jobs outstanding per user */
#define DEFAULT_BATCH_QUEUE 'E'
diff --git a/usr.bin/at/panic.c b/usr.bin/at/panic.c
index 731c2561c6f..007d540cce0 100644
--- a/usr.bin/at/panic.c
+++ b/usr.bin/at/panic.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: panic.c,v 1.8 2002/05/11 23:16:44 millert Exp $ */
+/* $OpenBSD: panic.c,v 1.9 2002/05/13 16:12:07 millert Exp $ */
/* $NetBSD: panic.c,v 1.2 1995/03/25 18:13:33 glass Exp $ */
/*
@@ -42,7 +42,7 @@
/* File scope variables */
#ifndef lint
-static const char rcsid[] = "$OpenBSD: panic.c,v 1.8 2002/05/11 23:16:44 millert Exp $";
+static const char rcsid[] = "$OpenBSD: panic.c,v 1.9 2002/05/13 16:12:07 millert Exp $";
#endif
/* External variables */
@@ -92,12 +92,24 @@ __dead void
usage(void)
{
/* Print usage and exit. */
- (void)fprintf(stderr,
- "Usage: at [-blmrv] [-f file] [-q queue] -t [[CC]YY]MMDDhhmm[.SS]\n"
- " at [-blmrv] [-f file] [-q queue] time\n"
- " at -c job [job ...]\n"
- " atq [-q queue] [-v]\n"
- " atrm job [job ...]\n"
- " batch [-mv] [-f file] [-q queue]\n");
+ switch (program) {
+ case AT:
+ case CAT:
+ (void)fprintf(stderr,
+ "Usage: at [-blmrv] [-f file] [-q queue] -t time_arg\n"
+ " at [-blmrv] [-f file] [-q queue] timespec\n"
+ " at -c job [job ...]\n");
+ break;
+ case ATQ:
+ (void)fprintf(stderr, "Usage: atq [-q queue] [-v]\n");
+ break;
+ case ATRM:
+ (void)fprintf(stderr, "Usage: atrm job [job ...]\n");
+ break;
+ case BATCH:
+ (void)fprintf(stderr,
+ "Usage: batch [-mv] [-f file] [-q queue] [timespec]\n");
+ break;
+ }
exit(EXIT_FAILURE);
}