#include <mit-copyright.h>
#include <stdio.h>
#include <string.h>
-#include <sms.h>
-#include <sms_app.h>
+#include <moira.h>
+#include <moira_site.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/time.h>
if (flag1 < 0) {
fprintf(stderr, "File %s does not need to be rebuilt.\n",
argv[1]);
- exit(SMS_NO_CHANGE);
+ exit(MR_NO_CHANGE);
}
}
targetfile = argv[1];
sprintf(filename, "%s~", targetfile);
if ((out = fopen(filename, "w")) == NULL) {
fprintf(stderr, "unable to open %s for output\n", filename);
- exit(SMS_OCONFIG);
+ exit(MR_OCONFIG);
}
} else if (argc != 1) {
fprintf(stderr, "usage: %s [outfile]\n", argv[0]);
- exit(SMS_ARGS);
+ exit(MR_ARGS);
}
## begin transaction
if (fclose(out)) {
perror("close failed");
- exit(SMS_CCONFIG);
+ exit(MR_CCONFIG);
}
if (argc == 2)
fix_file(targetfile);
- exit(SMS_SUCCESS);
+ exit(MR_SUCCESS);
}
switch (*num) {
case INGRES_DEADLOCK:
- ingres_errno = SMS_DEADLOCK;
+ ingres_errno = MR_DEADLOCK;
break;
default:
- ingres_errno = SMS_INGRES_ERR;
+ ingres_errno = MR_INGRES_ERR;
}
- com_err(whoami, SMS_INGRES_ERR, " code %d\n", *num);
+ com_err(whoami, MR_INGRES_ERR, " code %d\n", *num);
critical_alert("DCM", "Alias build encountered INGRES ERROR %d", *num);
exit(ingres_errno);
}
## int id, pid, bid, mid;
## char name[129], type[9], buf[257], fname[17], mname[17], lname[17];
## char year[9], dept[13], oaddr[17], ophone[13], haddr[81], hphone[17];
- char stuemp, *mhost, *uname, *pob;
+## char affil[5];
+ int mitroom, mitphone;
+ char stuemp, *mhost, *uname, *pob, *tmp;
struct hash *strings;
/* get locks */
uname = strtrim(name);
}
- fprintf(out, "%c:%s:%s:%s:%s:",
- stuemp, "", strtrim(lname), strtrim(fname), strtrim(mname));
- fprintf(out, "%s:%s:%s:%s:%s:%s:%s:%s:",
- strtrim(oaddr), "", strtrim(ophone), "",
- "", "", uname, mhost);
- fprintf(out, "%s:%s:%s:%s:%s:%s:%s:%s:%s:%s:%s:%d\n",
- strtrim(haddr), "", "", "", strtrim(hphone),
- "", "", "", "", year, "", id);
+ strtrim(oaddr);
+ if (oaddr[0] != ' ') {
+ tmp = &oaddr[strlen(oaddr) - 1];
+ if (*tmp == 'm' || *tmp == 'M') {
+ *tmp = 0;
+ }
+ }
+
+ if (tmp = index(ophone, '-')) {
+ bcopy(tmp+1, tmp, strlen(tmp)-1);
+ }
+ if (tmp = index(hphone, '-')) {
+ bcopy(tmp+1, tmp, strlen(tmp)-1);
+ }
+
+ fprintf(out, "%c:%s, %s %s:",
+ stuemp, strtrim(lname), strtrim(fname), strtrim(mname));
+ fprintf(out, "%s:%s:%s:%s::", lname, fname, mname, oaddr);
+ if (ophone[0] != ' ')
+ fprintf(out, "%010d:::%s:%s:%s:",
+ atoi(ophone), strtrim(dept), uname, mhost);
+ else
+ fprintf(out, ":::%s:%s:%s:",
+ strtrim(dept), uname, mhost);
+ if (hphone[0] != ' ')
+ fprintf(out, "%s:::::%010d::::%s::0\n",
+ strtrim(haddr), atoi(hphone), year);
+ else
+ fprintf(out, "%s:::::::::%s::0\n",
+ strtrim(haddr), year);
## }
##}