X-Git-Url: http://andersk.mit.edu/gitweb/moira.git/blobdiff_plain/20b9980fe7118385b759e6a9022f7207469b6be1..efd55ca6a0af254936ef83080bb1c4f9883663a5:/gen/directory.pc diff --git a/gen/directory.pc b/gen/directory.pc index 910c8072..75e6aafd 100644 --- a/gen/directory.pc +++ b/gen/directory.pc @@ -1,53 +1,47 @@ -/* $Header$ +/* $Id$ * * This generates a master /etc/passwd containing all active (status != 0) * accounts. * - * (c) Copyright 1988, 1990 by the Massachusetts Institute of Technology. - * For copying and distribution information, please see the file - * . + * Copyright (C) 1998 by the Massachusetts Institute of Technology. + * For copying and distribution information, please see the file + * . */ #include -#include #include -#include + #include -#include + +#include +#include + +#include "util.h" + EXEC SQL INCLUDE sqlca; -extern int errno; +RCSID("$Header$"); + char *whoami = "directory.gen"; char *db = "moira/moira"; int main(int argc, char **argv) { FILE *out = stdout; - char *outf = NULL, outft[64]; - struct stat sb; - int flag; + char *outf = NULL, outft[MAXPATHLEN]; EXEC SQL BEGIN DECLARE SECTION; - char login[9], last_name[17], first_name[17], middle_name[16]; - char office_address[17], office_phone[13]; - char home_address[82], home_phone[17]; - char id[17], type[9]; + char login[USERS_LOGIN_SIZE], last_name[USERS_LAST_SIZE]; + char first_name[USERS_FIRST_SIZE], middle_name[USERS_MIDDLE_SIZE]; + char office_address[USERS_OFFICE_ADDR_SIZE]; + char office_phone[USERS_OFFICE_PHONE_SIZE]; + char home_address[USERS_HOME_ADDR_SIZE], home_phone[USERS_HOME_PHONE_SIZE]; + char id[USERS_CLEARID_SIZE], type[USERS_TYPE_SIZE]; EXEC SQL END DECLARE SECTION; EXEC SQL CONNECT :db; if (argc == 2) { - if (stat(argv[1], &sb) == 0) - { - if (ModDiff (&flag, "users", sb.st_mtime)) - exit(MR_DATE); - if (flag < 0) - { - fprintf(stderr, "File %s does not need to be rebuilt.\n", - argv[1]); - exit(MR_NO_CHANGE); - } - } outf = argv[1]; sprintf(outft, "%s~", outf); if (!(out = fopen(outft, "w")))