version 1.25, 2005/11/16 16:45:11 |
version 1.29, 2015/02/08 23:40:34 |
|
|
* SUCH DAMAGE. |
* SUCH DAMAGE. |
*/ |
*/ |
|
|
#ifndef lint |
|
static const char copyright[] = |
|
"@(#) Copyright (c) 1989, 1993\n\ |
|
The Regents of the University of California. All rights reserved.\n"; |
|
#endif /* not lint */ |
|
|
|
#ifndef lint |
|
#if 0 |
|
static const char sccsid[] = "@(#)calendar.c 8.3 (Berkeley) 3/25/94"; |
|
#else |
|
static const char rcsid[] = "$OpenBSD$"; |
|
#endif |
|
#endif /* not lint */ |
|
|
|
#include <sys/stat.h> |
#include <sys/stat.h> |
#include <sys/types.h> |
#include <sys/types.h> |
#include <sys/wait.h> |
#include <sys/wait.h> |
|
|
break; |
break; |
|
|
case 'b': |
case 'b': |
bodun_always++; |
bodun_always = 1; |
break; |
break; |
|
|
case 'f': /* other calendar file */ |
case 'f': /* other calendar file */ |
|
|
warn("fork"); |
warn("fork"); |
continue; |
continue; |
case 0: /* child */ |
case 0: /* child */ |
|
(void)setpgid(getpid(), getpid()); |
(void)setlocale(LC_ALL, ""); |
(void)setlocale(LC_ALL, ""); |
if (setusercontext(NULL, pw, pw->pw_uid, |
if (setusercontext(NULL, pw, pw->pw_uid, |
LOGIN_SETALL ^ LOGIN_SETLOGIN)) |
LOGIN_SETALL ^ LOGIN_SETLOGIN)) |
|
|
/* It doesn't _really_ matter if the kill fails, e.g. |
/* It doesn't _really_ matter if the kill fails, e.g. |
* if there's only a zombie now. |
* if there's only a zombie now. |
*/ |
*/ |
(void)kill(kid, SIGTERM); |
if (getpgid(kid) != getpgrp()) |
|
(void)killpg(getpgid(kid), SIGTERM); |
|
else |
|
(void)kill(kid, SIGTERM); |
warnx("uid %u did not finish in time", pw->pw_uid); |
warnx("uid %u did not finish in time", pw->pw_uid); |
} |
} |
if (time(NULL) - t >= SECSPERDAY) |
if (time(NULL) - t >= SECSPERDAY) |
|
|
{ |
{ |
(void)fprintf(stderr, |
(void)fprintf(stderr, |
"usage: calendar [-ab] [-A num] [-B num] [-f calendarfile] " |
"usage: calendar [-ab] [-A num] [-B num] [-f calendarfile] " |
"[-t [[[cc]yy][mm]]dd]\n"); |
"[-t [[[cc]yy]mm]dd]\n"); |
exit(1); |
exit(1); |
} |
} |
|
|