-/* $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
- * <mit-copyright.h>.
+ * Copyright (C) 1998 by the Massachusetts Institute of Technology.
+ * For copying and distribution information, please see the file
+ * <mit-copyright.h>.
*/
#include <mit-copyright.h>
-#include <stdio.h>
#include <moira.h>
-#include <sys/types.h>
+
#include <sys/stat.h>
-#include <sys/time.h>
+
+#include <stdio.h>
+#include <time.h>
+
+#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")))
login, last, first, middle, office_addr, office_phone,
home_addr, home_phone, clearid, type
FROM users WHERE status = 1 AND type != 'SYSTEM' AND type != 'STAFF'
- AND type NOT LIKE 'GUES%';
+ AND type != 'TEST' and type != 'REGTEST' AND type NOT LIKE 'GUES%';
EXEC SQL OPEN x;
while (1)
{
"%s\t5:%s\t2:%s@mit.edu\t1:%s\t0:%s\t14:%s\t15:%s\t10:%s\n",
id, last_name, login, last_name, first_name, middle_name,
last_name, first_name, middle_name, login, login,
- "", "", "", "", strcmp(type, "G") == 0 ? "G" :
- !strncmp(type, "19", 2) ? "Undergraduate" :
- !strncmp(type, "20", 2) ? "Undergraduate" : "MIT Affiliate");
+ "", "", "", "", "MIT Affiliate");
#endif
}
EXEC SQL CLOSE x;