*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/usr.bin/at/at.c,v 1.29 2002/07/22 11:32:16 robert Exp $");
+__FBSDID("$FreeBSD: /usr/local/www/cvsroot/FreeBSD/src/usr.bin/at/at.c,v 1.34 2011/11/06 20:30:21 ed Exp $");
#define _USE_BSD 1
/* File scope variables */
-const char *no_export[] =
-{
+static const char *no_export[] = {
"TERM", "TERMCAP", "DISPLAY", "_"
-} ;
+};
static int send_mail = 0;
+static char *atinput = NULL; /* where to get input from */
+static char atqueue = 0; /* which queue to examine for jobs (atq) */
/* External variables */
extern char **environ;
int fcreated;
char atfile[] = ATJOB_DIR "12345678901234";
-
-char *atinput = (char*)0; /* where to get input from */
-char atqueue = 0; /* which queue to examine for jobs (atq) */
char atverify = 0; /* verify time instead of queuing job */
char *namep;
int posixly_correct; /* Behave as per POSIX */
}
static long
-nextjob()
+nextjob(void)
{
long jobno;
FILE *fid;
- if ((fid = fopen(ATJOB_DIR ".SEQ", "r+")) != (FILE*)0) {
+ if ((fid = fopen(ATJOB_DIR ".SEQ", "r+")) != NULL) {
if (fscanf(fid, "%5lx", &jobno) == 1) {
rewind(fid);
jobno = (1+jobno) % 0xfffff; /* 2^20 jobs enough? */
fclose(fid);
return jobno;
}
- else if ((fid = fopen(ATJOB_DIR ".SEQ", "w")) != (FILE*)0) {
+ else if ((fid = fopen(ATJOB_DIR ".SEQ", "w")) != NULL) {
fprintf(fid, "%05lx\n", jobno = 1);
fclose(fid);
return 1;
while((ch = getc(fp)) != EOF) {
putchar(ch);
}
+ fclose(fp);
}
break;
}
}
}
+ closedir(spool);
} /* process_jobs */
#define ATOI2(ar) ((ar)[0] - '0') * 10 + ((ar)[1] - '0'); (ar) += 2;