version 1.19, 2001/11/19 19:02:13 |
version 1.20, 2002/10/16 00:30:58 |
|
|
|
|
|
|
void |
void |
cal() |
cal(void) |
{ |
{ |
int printing; |
int printing; |
char *p; |
char *p; |
|
|
|
|
|
|
FILE * |
FILE * |
opencal() |
opencal(void) |
{ |
{ |
int pdes[2]; |
int pdes[2], fdin; |
int fdin; |
struct stat st; |
|
|
/* open up calendar file as stdin */ |
/* open up calendar file as stdin */ |
if ((fdin = open(calendarFile, O_RDONLY)) == -1) { |
if ((fdin = open(calendarFile, O_RDONLY)) == -1 || |
|
fstat(fdin, &st) == -1 || !S_ISREG(st.st_mode)) { |
if (!doall) { |
if (!doall) { |
char *home = getenv("HOME"); |
char *home = getenv("HOME"); |
if (home == NULL || *home == '\0') |
if (home == NULL || *home == '\0') |
|
|
calendarFile, calendarHome, calendarFile); |
calendarFile, calendarHome, calendarFile); |
} |
} |
} |
} |
|
|
if (pipe(pdes) < 0) |
if (pipe(pdes) < 0) |
return (NULL); |
return (NULL); |
switch (vfork()) { |
switch (vfork()) { |
|
|
(void)close(pdes[1]); |
(void)close(pdes[1]); |
} |
} |
(void)close(pdes[0]); |
(void)close(pdes[0]); |
/* Set stderr to /dev/null. Necessary so that cron does not |
/* |
|
* Set stderr to /dev/null. Necessary so that cron does not |
* wait for cpp to finish if it's running calendar -a. |
* wait for cpp to finish if it's running calendar -a. |
*/ |
*/ |
if (doall) { |
if (doall) { |