]> andersk Git - moira.git/blobdiff - regtape/staff.pc
Add ghba/get_host_by_account_number query.
[moira.git] / regtape / staff.pc
index 41cb8176ccf4f475e298d974ac01443ea132fa1a..8edf98ac71dd9f221b7696405dd6e07f835455ac 100644 (file)
@@ -81,11 +81,20 @@ int main(int argc, char **argv)
       if (!strcmp(argv[i], "-w"))
        wait++;
       else if (file)
-       fprintf(stderr, "Usage: %s [-w] inputfile\n", whoami);
+       {
+         fprintf(stderr, "Usage: %s [-w] inputfile\n", whoami);
+         exit(1);
+       }
       else
        file = argv[i];
     }
 
+  if (!file)
+    {
+      fprintf(stderr, "Usage: %s [-w] inputfile\n", whoami);
+      exit(1);
+    }
+
   in = fopen(file, "r");
   if (!in)
     {
@@ -128,7 +137,7 @@ struct entry *get_next_entry(FILE *in)
 {
   static struct entry e;
   static char buf[BUFSIZ];
-  static char name[LEN_NAME + 1], sname[LEN_NAME + 1], id[LEN_ID + 1];
+  static char name[LEN_NAME + 1], id[LEN_ID + 1];
   static char office[LEN_OFFICE + 1], phone[LEN_PHONE + 1];
   static char phone2[LEN_PHONE2 + 1], dept[LEN_DEPT + 1], title[LEN_TITLE + 1];
   int ends_sr, ends_jr, ends_iii, ends_iv, ends_ii, ends_v;
@@ -145,8 +154,6 @@ struct entry *get_next_entry(FILE *in)
   strlcpy(dept, &buf[LOC_DEPT], LEN_DEPT + 1);
   strlcpy(title, &buf[LOC_TITLE], LEN_TITLE + 1);
 
-  strcpy(sname, name);
-  e.name = strtrim(sname);
   p = strchr(name, ',');
   if (p)
     *p = '\0';
@@ -186,6 +193,12 @@ struct entry *get_next_entry(FILE *in)
   FixCase(e.first);
   FixCase(e.middle);
 
+  e.name = buf;
+  if (*e.middle)
+    sprintf(e.name, "%s %s %s", e.first, e.middle, e.last);
+  else
+    sprintf(e.name, "%s %s", e.first, e.last);
+
   e.id = id;
   e.haddr = e.hphone = "";
 
This page took 0.139389 seconds and 4 git commands to generate.