home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
rtsi.com
/
2014.01.www.rtsi.com.tar
/
www.rtsi.com
/
OS9
/
TOP
/
USR
/
SRC
/
vcron.t.Z
/
vcron.t
/
VCRON
/
database.c
< prev
next >
Wrap
Text File
|
1988-11-15
|
2KB
|
93 lines
/* $Source: /h0/usr/local/src/crond/database.c,v $
* $Revision: 1.3 $
* $Log: databasenew.c,v $
* Revision 1.3 88/04/20 20:30:00 ram
* OSK-Verion. use Group-entry for crontab-owner
*
* Revision 1.2 87/05/02 17:33:31 paul
* baseline for mod.sources release
*
* Revision 1.1 87/01/26 23:46:36 paul
* Initial revision
*
*/
/* Copyright 1987 by Vixie Enterprises
* All rights reserved
*
* Distribute freely, except: don't sell it, don't remove my name from the
* source or documentation (don't take credit for my work), mark your changes
* (don't get me blamed for your possible bugs), don't alter or remove this
* notice. Commercial redistribution is negotiable; contact me for details.
*
* Send bug reports, bug fixes, enhancements, requests, flames, etc., and
* I'll try to keep a version up to date. I can be reached as follows:
* Paul Vixie, Vixie Enterprises, 329 Noe Street, San Francisco, CA, 94114,
* (415) 864-7013, {ucbvax!dual,ames,ucsfmis,lll-crg,sun}!ptsfa!vixie!paul.
*/
#include "cron.h"
#include <pwd.h>
#include <grp.h>
# include <types.h>
void
free_database(db)
user *db;
{
void free_user();
user *u;
for (u = db; u != NULL; u = u->next)
free_user(u);
}
user *
load_database()
{
user *load_user();
struct passwd *pw;
REG user *db, *u;
struct group *crongrp;
REG char **i;
#if DEBUGGING
Debug(DPARS, "load_database()\n");
#endif
db = NULL;
if(!(crongrp =getgrnam(CRON_GRP))) {
perror("No Group entry for Cron-group\n");
exit(1);
}
for( i = crongrp->gr_mem; *i ; i++) {
if(pw = getpwnam(*i)) {
#if DEBUGGING
Debug(DPARS, "\t%s\n", i);
#endif
u = load_user(
pw->pw_name,
pw->pw_uid,
pw->pw_gid,
pw->pw_dir,
pw->pw_xdir,
pw->pw_shell );
if (u == NULL)
{
/* no crontab for this user
*/
continue;
}
u->next = db;
db = u;
}
}
endpwent();
endgrent();
return db ;
}