[2020] in Moira Commits

home help back first fref pref prev next nref lref last post

/svn/moira r4162 - trunk/moira/regtape

daemon@ATHENA.MIT.EDU (Garry Zacheiss)
Tue May 27 14:33:40 2014

Date: Tue, 27 May 2014 14:33:33 -0400
From: Garry Zacheiss <zacheiss@MIT.EDU>
Message-Id: <201405271833.s4RIXXF8004972@drugstore.mit.edu>
To: moira-commits@MIT.EDU
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Author: zacheiss
Date: 2014-05-27 14:33:33 -0400 (Tue, 27 May 2014)
New Revision: 4162

Modified:
   trunk/moira/regtape/common.h
   trunk/moira/regtape/common.pc
   trunk/moira/regtape/staff.pc
   trunk/moira/regtape/student.pc
Log:
Implement -n flag to only add new user entries.

Modified: trunk/moira/regtape/common.h
===================================================================
--- trunk/moira/regtape/common.h	2014-04-24 13:44:03 UTC (rev 4161)
+++ trunk/moira/regtape/common.h	2014-05-27 18:33:33 UTC (rev 4162)
@@ -34,7 +34,7 @@
 void fixphone(char *phone);
 void fixaddress(char *address);
 
-void process_entry(struct entry *e, int secure);
+void process_entry(struct entry *e, int secure, int newonly);
 void newuser(struct entry *e, int secure);
 
 int set_next_users_id(void);

Modified: trunk/moira/regtape/common.pc
===================================================================
--- trunk/moira/regtape/common.pc	2014-04-24 13:44:03 UTC (rev 4161)
+++ trunk/moira/regtape/common.pc	2014-05-27 18:33:33 UTC (rev 4162)
@@ -57,7 +57,7 @@
     *p = ';';
 }  
 
-void process_entry(struct entry *e, int secure)
+void process_entry(struct entry *e, int secure, int newonly)
 {
   int changed;
   char buf[MAX_FIELD_WIDTH], *from, *to;
@@ -114,6 +114,10 @@
       newuser(e, secure);
       return;
     }
+
+  if (newonly)
+    return;
+
   strtrim(dfirst);
   strtrim(dlast);
   strtrim(dmiddle);

Modified: trunk/moira/regtape/staff.pc
===================================================================
--- trunk/moira/regtape/staff.pc	2014-04-24 13:44:03 UTC (rev 4161)
+++ trunk/moira/regtape/staff.pc	2014-05-27 18:33:33 UTC (rev 4162)
@@ -59,9 +59,6 @@
 #define LOC_EMAIL_ADDRESS (LOC_EMPLOYEE_TYPE + LEN_EMPLOYEE_TYPE)
 #define LEN_EMAIL_ADDRESS 100
 
-struct entry *get_next_entry(FILE *in);
-void process_entry(struct entry *e, int secure);
-
 EXEC SQL BEGIN DECLARE SECTION;
 int who;
 char *prog = "stafload";
@@ -69,11 +66,13 @@
 
 char *whoami;
 
+struct entry *get_next_entry(FILE *in);
+
 int main(int argc, char **argv)
 {
   FILE *in;
   struct entry *e;
-  int i, wait = 0;
+  int i, wait = 0, newonly = 0;
   char buf[80], *file = NULL;
   EXEC SQL BEGIN DECLARE SECTION;
   char *db = "moira";
@@ -92,9 +91,11 @@
     {
       if (!strcmp(argv[i], "-w"))
 	wait++;
+      else if (!strcmp(argv[i], "-n"))
+	newonly++;
       else if (file)
 	{
-	  fprintf(stderr, "Usage: %s [-w] inputfile\n", whoami);
+	  fprintf(stderr, "Usage: %s [-w] [-n] inputfile\n", whoami);
 	  exit(1);
 	}
       else
@@ -103,7 +104,7 @@
 
   if (!file)
     {
-      fprintf(stderr, "Usage: %s [-w] inputfile\n", whoami);
+      fprintf(stderr, "Usage: %s [-w] [-n] inputfile\n", whoami);
       exit(1);
     }
 
@@ -127,7 +128,7 @@
 
   while ((e = get_next_entry(in)))
     {
-      process_entry(e, 0);
+      process_entry(e, 0, newonly);
       EXEC SQL COMMIT WORK;
       if (sqlca.sqlcode)
 	{

Modified: trunk/moira/regtape/student.pc
===================================================================
--- trunk/moira/regtape/student.pc	2014-04-24 13:44:03 UTC (rev 4161)
+++ trunk/moira/regtape/student.pc	2014-05-27 18:33:33 UTC (rev 4162)
@@ -82,13 +82,12 @@
 char *whoami;
 
 struct entry *get_next_entry(FILE *in);
-void process_entry(struct entry *e, int secure);
 
 int main(int argc, char **argv)
 {
   FILE *in;
   struct entry *e;
-  int i, wait = 0;
+  int i, wait = 0, newonly = 0;
   char buf[80], *file = NULL;
   EXEC SQL BEGIN DECLARE SECTION;
   char *db = "moira";
@@ -107,9 +106,11 @@
     {
       if (!strcmp(argv[i], "-w"))
 	wait++;
-      if (file)
+      else if (!strcmp(argv[i], "-n"))
+	newonly++;
+      else if (file)
 	{
-	  fprintf(stderr, "Usage: %s [-w] inputfile\n", whoami);
+	  fprintf(stderr, "Usage: %s [-w] [-n] inputfile\n", whoami);
 	  exit(1);
 	}
       else
@@ -118,7 +119,7 @@
 
   if (!file)
     {
-      fprintf(stderr, "Usage: %s [-w] inputfile\n", whoami);
+      fprintf(stderr, "Usage: %s [-w] [-n] inputfile\n", whoami);
       exit(1);
     }
 
@@ -147,9 +148,9 @@
        */
       if (!strcmp(e->reg_type, "Cross-Registered") ||
           !strcmp(e->reg_type, "Special"))
-	process_entry(e, 0);   
+	process_entry(e, 0, newonly);   
       else
-	process_entry(e, 1);
+	process_entry(e, 1, newonly);
       EXEC SQL COMMIT WORK;
       if (sqlca.sqlcode)
 	{


home help back first fref pref prev next nref lref last post