]> andersk Git - moira.git/blobdiff - clients/passwd/chfn.c
*** empty log message ***
[moira.git] / clients / passwd / chfn.c
index f0e7aef9c0b19c9d28faccce8f01e7bb45ad41eb..c791c62c8a0ae8b42e05db3726c662d956094068 100644 (file)
@@ -13,7 +13,7 @@ static char *rcsid_chfn_c = "$Header$";
 #endif not lint
 
 /*
- * Talk to the SMS database to change a person's GECOS information.
+ * Talk to the MOIRA database to change a person's GECOS information.
  * 
  * chfn with no modifiers changes the information of the user who is 
  * running the program.
@@ -28,16 +28,15 @@ static char *rcsid_chfn_c = "$Header$";
 
 #include <sys/types.h>
 #include <stdio.h>
-#include <strings.h>
-#include <ctype.h>
+#include <string.h>
 #include <sys/file.h>
 #include <krb.h>
 #include <ctype.h>
 #include <errno.h>
 
-/* SMS includes */
-#include <sms.h>
-#include <sms_app.h>
+/* MOIRA includes */
+#include <moira.h>
+#include <moira_site.h>
 #include "mit-copyright.h"
 
 char *whoami;
@@ -64,7 +63,7 @@ main(argc, argv)
     int k_errno;
     char *whoami;
 
-    if ((whoami = rindex(argv[0], '/')) == NULL)
+    if ((whoami = strrchr(argv[0], '/')) == NULL)
        whoami = argv[0];
     else
        whoami++;
@@ -98,10 +97,10 @@ main(argc, argv)
 
 leave(status)
   int status;
-  /* This should be called rather than exit once connection to sms server
+  /* This should be called rather than exit once connection to moira server
      has been established. */
 {
-    sms_disconnect();
+    mr_disconnect();
     exit(status);
 }
 
@@ -115,9 +114,9 @@ chfn(uname)
   char *uname;
 {
     int status;                        /* general purpose exit status */
-    int q_argc;                        /* argc for sms_query */
-    char *q_argv[F_END];       /* argv for sms_query */
-    char *motd;                        /* for SMS server status */
+    int q_argc;                        /* argc for mr_query */
+    char *q_argv[F_END];       /* argv for mr_query */
+    char *motd;                        /* for MR server status */
     int i;
 
     int get_user_info();
@@ -128,15 +127,15 @@ chfn(uname)
 
     /* Try each query.  If we ever fail, print error message and exit. */
 
-    status = sms_connect(SMS_SERVER);
+    status = mr_connect(NULL);
     if (status) {
-       com_err(whoami, status, " while connecting to Moira");
+       com_err(whoami, status, "while connecting to Moira");
        exit(1);
     }
 
-    status = sms_motd(&motd);
+    status = mr_motd(&motd);
     if (status) {
-        com_err(whoami, status, " unable to check server status");
+        com_err(whoami, status, "unable to check server status");
        leave(1);
     }
     if (motd) {
@@ -144,10 +143,10 @@ chfn(uname)
        leave(1);
     }
 
-    status = sms_auth("chfn"); /* Don't use argv[0] - too easy to fake */
+    status = mr_auth("chfn");  /* Don't use argv[0] - too easy to fake */
     if (status) {
        com_err(whoami, status, 
-               " while authenticating -- run \"kinit\" and try again.");
+               "while authenticating -- run \"kinit\" and try again.");
        leave(1);
     }
 
@@ -158,7 +157,7 @@ chfn(uname)
        q_argv[i] = "junk";
     q_argc = F_MODTIME;                /* one more than the last updatable field */
     
-    if (status = sms_access("update_finger_by_login", q_argc, q_argv)) {
+    if (status = mr_access("update_finger_by_login", q_argc, q_argv)) {
        com_err(whoami, status, "; finger\ninformation not changed.");
        leave(2);
     }
@@ -169,10 +168,10 @@ chfn(uname)
 
     q_argv[NAME] = uname;
     q_argc = NAME + 1;
-    if (status = sms_query("get_finger_by_login", q_argc, q_argv, 
+    if (status = mr_query("get_finger_by_login", q_argc, q_argv, 
                       get_user_info, (char *) &old_info))
     {
-       com_err(whoami, status, " while getting user information.");
+       com_err(whoami, status, "while getting user information.");
        leave(2);
     }
 
@@ -195,10 +194,10 @@ chfn(uname)
     q_argv[F_MIT_AFFIL] = new_info.mit_year;
     q_argc = F_MODTIME;                /* First non-update query argument */
 
-    if (status = sms_query("update_finger_by_login", q_argc, q_argv,
+    if (status = mr_query("update_finger_by_login", q_argc, q_argv,
                           scream, (char *)NULL))
     {
-       com_err(whoami, status, " while updating finger information.");
+       com_err(whoami, status, "while updating finger information.");
        leave(1);
     }
 
@@ -233,7 +232,7 @@ get_user_info(argc, argv, message)
     
     /* Only pay attention to the first match since login names are
        unique in the database. */
-    return(SMS_ABORT);
+    return(MR_ABORT);
 }
 
 char *ask(question, def_val, phone_num)
@@ -291,13 +290,13 @@ char *ask(question, def_val, phone_num)
        }
        
        if (phone_num && ok) {
-           for (i = 0; i < strlen(buf); i++) {
-               if (!isdigit(buf[i]) && (buf[i] != '-')) {
+           for (i = 0; i < strlen(result); i++) {
+               if (!isdigit(result[i]) && (result[i] != '-')) {
                    printf("Phone numbers can contain only digits.\n");
                    ok = FALSE;
                    break;
                }
-               if (buf[i] == '-')
+               if (result[i] == '-')
                    dashes = TRUE;
             }
         }
@@ -335,7 +334,7 @@ void get_new_info(old_info, new_info)
     GETINFO("Office address (Exs: E40-342 or 2-108)", 
            office_address, FALSE);
     GETINFO("Office phone (Ex: 3-1300)", office_phone, TRUE);
-    GETINFO("MIT department (Exs: 9, Biology, Information Services", 
+    GETINFO("MIT department (Exs: 9, Biology, Information Services)", 
            mit_department, FALSE);
     GETINFO("MIT year (Exs: 1989, '91, Faculty, Grad)", mit_year, FALSE);
 }
This page took 0.034295 seconds and 4 git commands to generate.