cvsdist f99ae4
--- at-3.1.8/at.1.in-t_option	2004-08-03 17:27:23.458423000 -0400
cvsdist f99ae4
+++ at-3.1.8/at.1.in	2004-08-03 17:27:43.923938000 -0400
cvsdist e83c0d
@@ -12,6 +12,16 @@
cvsdist e83c0d
 .RB [ -mldbv ]
cvsdist e83c0d
 .B TIME
cvsdist e83c0d
 .br
cvsdist e83c0d
+.B at
cvsdist e83c0d
+.RB [ -V ]
cvsdist e83c0d
+.RB [ -q 
cvsdist e83c0d
+.IR queue ]
cvsdist e83c0d
+.RB [ -f
cvsdist e83c0d
+.IR file ]
cvsdist e83c0d
+.RB [ -mldbv ]
cvsdist e83c0d
+.RB -t
cvsdist e83c0d
+.IR time_arg
cvsdist e83c0d
+.br
cvsdist e83c0d
 .B "at -c"
cvsdist e83c0d
 .I job
cvsdist e83c0d
 .RI [ job... ]
cvsdist e83c0d
@@ -235,6 +245,15 @@
cvsdist e83c0d
 .B
cvsdist e83c0d
 \-c
cvsdist e83c0d
 cats the jobs listed on the command line to standard output.
cvsdist e83c0d
+.TP
cvsdist e83c0d
+.BI \-t " time_arg"
cvsdist e83c0d
+Submit the job to be run at the time specified by the 
cvsdist e83c0d
+.BI time_arg
cvsdist e83c0d
+option argument, which must have the same format as specified for the 
cvsdist e83c0d
+.BR touch(1)
cvsdist e83c0d
+utility's 
cvsdist e83c0d
+.B -t
cvsdist f99ae4
+time option argument ([[CC]YY]MMDDhhmm).
cvsdist e83c0d
 .SH FILES
cvsdist e83c0d
 .I @ATJBD@
cvsdist e83c0d
 .br
cvsdist f99ae4
--- at-3.1.8/at.c-t_option	2004-08-03 17:27:24.036844000 -0400
cvsdist f99ae4
+++ at-3.1.8/at.c	2004-08-03 17:27:24.246634000 -0400
cvsdist e83c0d
@@ -688,6 +688,100 @@
cvsdist e83c0d
     return p;
cvsdist e83c0d
 }
cvsdist e83c0d
 
cvsdist e83c0d
+/* Handle POSIX.2 '-t' option :
cvsdist e83c0d
+ *  Parses time string in "touch(1)" format:
cvsdist e83c0d
+ *       [[CC]YY]MMDDhhmm[.ss]
cvsdist e83c0d
+ *  and returns time_t .
cvsdist e83c0d
+ */
cvsdist e83c0d
+time_t
cvsdist e83c0d
+t_option(char *s)
cvsdist e83c0d
+{
cvsdist e83c0d
+    time_t t=time(0L);
cvsdist e83c0d
+    struct tm tm, tm_now=*localtime(&t);
cvsdist e83c0d
+    int l;
cvsdist e83c0d
+    
cvsdist e83c0d
+    if((s == 0L) || (*s == '\0'))
cvsdist e83c0d
+    {
cvsdist e83c0d
+	return 0L;
cvsdist e83c0d
+    };
cvsdist e83c0d
+    memset(&tm,'\0',sizeof(tm));
cvsdist e83c0d
+    l = strnlen(s,15);
cvsdist e83c0d
+    switch(l)
cvsdist e83c0d
+    {
cvsdist e83c0d
+    case 15:
cvsdist e83c0d
+	/* CCYYMMDDhhmm.ss */
cvsdist e83c0d
+	sscanf(s, "%4d%2d%2d%2d%2d.%2d",
cvsdist e83c0d
+	       &tm.tm_year, &tm.tm_mon, &tm.tm_mday, &tm.tm_hour, &tm.tm_min, &tm.tm_sec
cvsdist e83c0d
+	      );
cvsdist e83c0d
+	if(tm.tm_year)
cvsdist e83c0d
+	    tm.tm_year -= 1900 ;
cvsdist e83c0d
+
cvsdist e83c0d
+	break;    
cvsdist e83c0d
+
cvsdist e83c0d
+    case 13:
cvsdist e83c0d
+	/* YYMMDDhhmm.ss */
cvsdist e83c0d
+	sscanf(s, "%2d%2d%2d%2d%2d.%2d",
cvsdist e83c0d
+	       &tm.tm_year, &tm.tm_mon, &tm.tm_mday, &tm.tm_hour, &tm.tm_min, &tm.tm_sec
cvsdist e83c0d
+	      );
cvsdist e83c0d
+	if(tm.tm_year)
cvsdist e83c0d
+	    tm.tm_year += 100 ; /* Y2.1K+ bug! */
cvsdist e83c0d
+
cvsdist e83c0d
+	break;
cvsdist e83c0d
+
cvsdist e83c0d
+    case 11:
cvsdist e83c0d
+	/* MMDDhhmm.ss */
cvsdist e83c0d
+	sscanf(s, "%2d%2d%2d%2d.%2d",
cvsdist e83c0d
+	       &tm.tm_mon, &tm.tm_mday, &tm.tm_hour, &tm.tm_min, &tm.tm_sec
cvsdist e83c0d
+	      );
cvsdist e83c0d
+		
cvsdist e83c0d
+	tm.tm_year = tm_now.tm_year;
cvsdist e83c0d
+		
cvsdist e83c0d
+	if(tm.tm_mon)
cvsdist e83c0d
+	    tm.tm_mon -= 1;				
cvsdist e83c0d
+	break;
cvsdist e83c0d
+	
cvsdist e83c0d
+    case 12:
cvsdist e83c0d
+	/* CCYYMMDDhhmm */
cvsdist e83c0d
+	sscanf(s, "%4d%2d%2d%2d%2d",
cvsdist e83c0d
+	       &tm.tm_year, &tm.tm_mon, &tm.tm_mday, &tm.tm_hour, &tm.tm_min
cvsdist e83c0d
+	      );
cvsdist e83c0d
+	if(tm.tm_year)
cvsdist e83c0d
+	    tm.tm_year -= 1900 ;
cvsdist e83c0d
+	break;    
cvsdist e83c0d
+
cvsdist e83c0d
+    case 10:
cvsdist e83c0d
+	/* YYMMDDhhmm */
cvsdist e83c0d
+	sscanf(s, "%2d%2d%2d%2d%2d",
cvsdist e83c0d
+	       &tm.tm_year, &tm.tm_mon, &tm.tm_mday, &tm.tm_hour, &tm.tm_min
cvsdist e83c0d
+	      );
cvsdist e83c0d
+	if(tm.tm_year)
cvsdist e83c0d
+	    tm.tm_year += 100 ; /* Y2.1K+ bug! */
cvsdist e83c0d
+	break;    
cvsdist e83c0d
+   
cvsdist e83c0d
+    case  8:
cvsdist e83c0d
+	/* MMDDhhmm */
cvsdist e83c0d
+	sscanf(s, "%2d%2d%2d%2d",
cvsdist e83c0d
+	       &tm.tm_mon, &tm.tm_mday, &tm.tm_hour, &tm.tm_min
cvsdist e83c0d
+	      );
cvsdist e83c0d
+	if( tm.tm_mday )
cvsdist e83c0d
+	    tm.tm_year = tm_now.tm_year;
cvsdist e83c0d
+	break;    
cvsdist e83c0d
+
cvsdist e83c0d
+    default:    
cvsdist e83c0d
+	break;    
cvsdist e83c0d
+    }
cvsdist e83c0d
+
cvsdist e83c0d
+    if( tm.tm_mon )
cvsdist e83c0d
+	tm.tm_mon -= 1;
cvsdist e83c0d
+
cvsdist e83c0d
+    if( tm.tm_mday )
cvsdist e83c0d
+    {
cvsdist e83c0d
+	tm.tm_isdst = tm_now.tm_isdst;
cvsdist e83c0d
+	return mktime(&tm;;
cvsdist e83c0d
+    }else
cvsdist e83c0d
+	return 0L;
cvsdist e83c0d
+}
cvsdist e83c0d
+ 
cvsdist e83c0d
 int
cvsdist e83c0d
 main(int argc, char **argv)
cvsdist e83c0d
 {
cvsdist e83c0d
@@ -697,9 +791,9 @@
cvsdist e83c0d
     char *pgm;
cvsdist e83c0d
 
cvsdist e83c0d
     int program = AT;		/* our default program */
cvsdist e83c0d
-    char *options = "q:f:MmvldhVc";	/* default options for at */
cvsdist e83c0d
+    char *options = "q:f:MmvldhVct:";	/* default options for at */
cvsdist e83c0d
     int disp_version = 0;
cvsdist e83c0d
-    time_t timer;
cvsdist e83c0d
+    time_t timer=0L;
cvsdist e83c0d
     struct passwd *pwe;
cvsdist e83c0d
     struct group *ge;
cvsdist e83c0d
 
cvsdist e83c0d
@@ -802,6 +896,10 @@
cvsdist e83c0d
 	    options = "";
cvsdist e83c0d
 	    break;
cvsdist e83c0d
 
cvsdist e83c0d
+	case 't':
cvsdist e83c0d
+	    timer = t_option(optarg);
cvsdist e83c0d
+	    break;
cvsdist e83c0d
+
cvsdist e83c0d
 	default:
cvsdist e83c0d
 	    usage();
cvsdist e83c0d
 	    break;
cvsdist e83c0d
@@ -838,10 +936,13 @@
cvsdist e83c0d
 	break;
cvsdist e83c0d
 
cvsdist e83c0d
     case AT:
cvsdist e83c0d
-	if (argc > optind) {
cvsdist e83c0d
-	    timer = parsetime(argc - optind, argv + optind);
cvsdist e83c0d
-	} else {
cvsdist e83c0d
-	    timer = 0;
cvsdist e83c0d
+	if( timer == 0 )
cvsdist e83c0d
+	{
cvsdist e83c0d
+	    if (argc > optind) {
cvsdist e83c0d
+		timer = parsetime(argc - optind, argv + optind);
cvsdist e83c0d
+	    } else {
cvsdist e83c0d
+		timer = 0;
cvsdist e83c0d
+	    }
cvsdist e83c0d
 	}
cvsdist e83c0d
 
cvsdist e83c0d
 	if (timer == 0) {
cvsdist e83c0d
@@ -870,16 +971,20 @@
cvsdist e83c0d
 	    queue = toupper(queue);
cvsdist e83c0d
 	else
cvsdist e83c0d
 	    queue = DEFAULT_BATCH_QUEUE;
cvsdist e83c0d
-
cvsdist e83c0d
-	if (argc > optind)
cvsdist e83c0d
-	    timer = parsetime(argc, argv);
cvsdist e83c0d
-	else
cvsdist e83c0d
-	    timer = time(NULL);
cvsdist e83c0d
+	
cvsdist e83c0d
+	if( timer == 0L )
cvsdist e83c0d
+	{
cvsdist e83c0d
+	    if (argc > optind)
cvsdist e83c0d
+		timer = parsetime(argc, argv);
cvsdist e83c0d
+	    else
cvsdist e83c0d
+		timer = time(NULL);
cvsdist e83c0d
+	}
cvsdist e83c0d
 
cvsdist e83c0d
 	if (atverify) {
cvsdist e83c0d
 	    struct tm *tm = localtime(&timer;;
cvsdist e83c0d
 	    fprintf(stderr, "%s\n", asctime(tm));
cvsdist e83c0d
 	}
cvsdist e83c0d
+
cvsdist e83c0d
 	writefile(timer, queue);
cvsdist e83c0d
 	break;
cvsdist e83c0d