Index: trunk/tools/lsexp/lsexp.c |
— | — | @@ -0,0 +1,37 @@ |
| 2 | +/* |
| 3 | + * Print all expired accounts. |
| 4 | + * $Id$ |
| 5 | + */ |
| 6 | + |
| 7 | +#include <sys/types.h> |
| 8 | +#include <sys/time.h> |
| 9 | +#include <stdio.h> |
| 10 | +#include <pwd.h> |
| 11 | +#include <time.h> |
| 12 | +#include <unistd.h> |
| 13 | +#include <errno.h> |
| 14 | +#include <string.h> |
| 15 | +#include <shadow.h> |
| 16 | + |
| 17 | +int |
| 18 | +main(void) |
| 19 | +{ |
| 20 | +struct spwd *spwent; |
| 21 | +time_t when, now; |
| 22 | + |
| 23 | + time(&now); |
| 24 | + |
| 25 | + while (spwent = getspent()) { |
| 26 | + if (spwent->sp_expire <= 0) |
| 27 | + continue; |
| 28 | + |
| 29 | + when = spwent->sp_expire * 24 * 60 * 60; |
| 30 | + |
| 31 | + if (when > now) |
| 32 | + continue; |
| 33 | + |
| 34 | + printf("%s\n", spwent->sp_namp); |
| 35 | + } |
| 36 | + |
| 37 | + return 0; |
| 38 | +} |
Property changes on: trunk/tools/lsexp/lsexp.c |
___________________________________________________________________ |
Added: svn:keywords |
1 | 39 | + Id Revision |
Index: trunk/tools/lsexp/Makefile |
— | — | @@ -0,0 +1,6 @@ |
| 2 | +lsexp: lsexp.c |
| 3 | + gcc -W -Wall -O lsexp.c -o lsexp |
| 4 | +install: |
| 5 | + install -c -m 755 -o root -g bin lsexp /usr/local/sbin |
| 6 | +clean: |
| 7 | + rm -f lsexp |
Property changes on: trunk/tools/lsexp/Makefile |
___________________________________________________________________ |
Added: svn:keywords |
1 | 8 | + Id Revision |