Project

General

Profile

Bug #1432 ยป at.diff

Anonymous, 07/20/2009 04:39 PM

View differences:

usr.bin/at/at.c
static void list_jobs(long *, int);
static long nextjob(void);
static time_t ttime(const char *arg);
static char * timer2str(time_t runtimer);
static int in_job_list(long, long *, int);
static long *get_job_list(int, char *[], int *);
......
perr("cannot give away file");
close(fd2);
/* Print output. */
char *timestr = timer2str(runtimer);
fprintf(stderr, "Job %ld will be executed using /bin/sh\n", jobno);
fprintf(stderr, "Job %ld at %s\n", jobno, timestr);
free(timestr);
}
static int
......
DIR *spool;
struct dirent *dirent;
struct stat buf;
struct tm runtime;
unsigned long ctm;
char queue;
long jobno;
time_t runtimer;
char timestr[TIMESIZE];
char *timestr;
int first=1;
setlocale(LC_TIME, "");
......
continue;
runtimer = 60*(time_t) ctm;
runtime = *localtime(&runtimer);
strftime(timestr, TIMESIZE, nl_langinfo(D_T_FMT), &runtime);
timestr = timer2str(runtimer);
if (first) {
printf("Date\t\t\t\tOwner\t\tQueue\tJob#\n");
first=0;
......
queue,
(S_IXUSR & buf.st_mode) ? "":"(done)",
jobno);
free(timestr);
}
closedir(spool);
......
"out of range or illegal time specification: [[CC]YY]MMDDhhmm[.SS]");
}
/* The caller must free up the memory. */
static char *
timer2str(time_t runtimer)
{
struct tm runtime;
char *timestr;
size_t rv;
timestr = malloc(TIMESIZE);
if (timestr == NULL)
panic("out of memory");
runtime = *localtime(&runtimer);
rv = strftime(timestr, TIMESIZE, nl_langinfo(D_T_FMT), &runtime);
if (rv == 0)
panic("TIMESIZE too low");
return (timestr);
}
static long *
get_job_list(int argc, char *argv[], int *joblen)
{
    (1-1/1)