]> andersk Git - moira.git/blobdiff - clients/moira/attach.c
Added some casts for ANSI standard.
[moira.git] / clients / moira / attach.c
index d99126da05196f3f1c66a5bfb0b88bbaa3847d56..569362065878ccc121aeef90ab85bb725c5308b1 100644 (file)
@@ -2,21 +2,20 @@
   static char rcsid_module_c[] = "$Header$";
 #endif
 
-/*     This is the file attach.c for allmaint, the SMS client that allows
- *      a user to maintaint most important parts of the SMS database.
+/*     This is the file attach.c for the SMS Client, which allows a nieve
+ *      user to quickly and easily maintain most parts of the SMS database.
  *     It Contains: Functions for maintaining data used by Hesiod 
  *                   to map courses/projects/users to their file systems, 
  *                   and maintain filesys info. 
  *     
  *     Created:        5/4/88
  *     By:             Chris D. Peterson
- *      Based Upon:     attach.c 87/07/24 marcus
  *
  *      $Source$
  *      $Author$
  *      $Header$
  *     
- *     Copyright 1987, 1988 by the Massachusetts Institute of Technology.
+ *     Copyright 1988 by the Massachusetts Institute of Technology.
  *
  *     For further information on copyright and distribution 
  *     see the file mit-copyright.h
@@ -28,8 +27,8 @@
 #include <menu.h>
 
 #include "mit-copyright.h"
-#include "allmaint.h"
-#include "allmaint_funcs.h"
+#include "defs.h"
+#include "f_defs.h"
 #include "globals.h"
 #include "infodefs.h"
 
@@ -96,21 +95,21 @@ char *name;
     switch (type) {
     case LABEL:
        if ( (stat = sms_query("get_filesys_by_label", 1, &name,
-                              StoreInfo, &elem)) != 0) {
+                              StoreInfo, (char *)&elem)) != 0) {
            com_err(program_name, stat, NULL);
            return(NULL);
        }
        break;
     case MACHINE:
        if ( (stat = sms_query("get_filesys_by_machine", 1, &name,
-                              StoreInfo, &elem)) != 0) {
+                              StoreInfo, (char *)&elem)) != 0) {
            com_err(program_name, stat, NULL);
            return(NULL);
        }
        break;
     case GROUP:
        if ( (stat = sms_query("get_filesys_by_group", 1, &name,
-                              StoreInfo, &elem)) != 0) {
+                              StoreInfo, (char *)&elem)) != 0) {
            com_err(program_name, stat, NULL);
            return(NULL);
        }
@@ -119,7 +118,8 @@ char *name;
        args[ALIAS_NAME] = name;
        args[ALIAS_TYPE] = FS_ALIAS_TYPE;
        args[ALIAS_TRANS] = "*";
-       if ( (stat = sms_query("get_alias", 3, args, StoreInfo, &elem)) != 0) {
+       if ( (stat = sms_query("get_alias", 3, args, StoreInfo, 
+                              (char *) &elem)) != 0) {
            com_err(program_name, stat, " in get_alias.");
            return(NULL);
        }
@@ -172,11 +172,12 @@ char ** info;
     sprintf(print_buf, "User Ownership: %-30s Group Ownership: %s",
            info[FS_OWNER], info[FS_OWNERS]);
     Put_message(print_buf);
-    sprintf(print_buf, "Auto Create %-34s Locker Type: %s",info[FS_CREATE], 
+    sprintf(print_buf, "Auto Create: %-34s Locker Type: %s",
+           atoi(info[FS_CREATE]) ? "ON" : "OFF", 
            info[FS_L_TYPE]);
     Put_message(print_buf);
-    sprintf(print_buf, "Last Modified at %s, by %s with %s",
-           info[FS_MODTIME], info[FS_MODBY], info[FS_MODWITH]);
+    sprintf(print_buf, MOD_FORMAT, info[FS_MODBY], info[FS_MODTIME], 
+           info[FS_MODWITH]);
     Put_message(print_buf);
     return(info[FS_NAME]);
 }
@@ -220,7 +221,7 @@ Bool name;
     GetValueFromUser("Comments about this Filesystem", &info[FS_COMMENTS]);
     GetValueFromUser("Filesystem's owner (user)", &info[FS_OWNER]);
     GetValueFromUser("Filesystem's owners (group)", &info[FS_OWNERS]);
-    GetValueFromUser("Automatically create this filsystem (0/1)",
+    GetYesNoValueFromUser("Automatically create this filsystem",
                     &info[FS_CREATE]);
     GetValueFromUser("Filesystem's lockertype", &info[FS_L_TYPE]);
 
@@ -248,14 +249,10 @@ GetFS(argc, argv)
 int argc;
 char **argv;
 {
-    struct qelem *top, *elem;
+    struct qelem *top;
 
-    top = elem = GetFSInfo(LABEL, argv[1]); /* get info. */
-    while(elem != NULL) {
-       char ** info = (char **) elem->q_data;
-       (void) PrintFSInfo(info);
-       elem = elem->q_forw;
-    }
+    top = GetFSInfo(LABEL, argv[1]); /* get info. */
+    Loop(top, (void *) PrintFSInfo);
     FreeQueue(top);            /* clean the queue. */
     return (DM_NORMAL);
 }
@@ -408,17 +405,11 @@ GetFSAlias(argc, argv)
 int argc;
 char **argv;
 {
-    struct qelem *top, *elem;
-
-    top = elem = GetFSInfo(ALIAS, argv[1]);
+    struct qelem *top;
 
+    top = GetFSInfo(ALIAS, argv[1]);
     Put_message(" ");          /* blank line. */
-    while (elem != NULL) {
-       char **info = (char **) elem->q_data;
-       PrintFSAlias(info);
-       elem = elem->q_forw;
-    }
-
+    Loop(top, (void *) PrintFSAlias);
     FreeQueue(top);
     return(DM_NORMAL);
 }
@@ -455,7 +446,8 @@ char **argv;
  * print out values, free memory used and then exit.
  */
 
-    if ( (stat = sms_query("get_alias", 3, args, StoreInfo, &elem)) == 0) {
+    if ( (stat = sms_query("get_alias", 3, args, StoreInfo, 
+                          (char *)&elem)) == 0) {
        top = elem = QueueTop(elem);
        while (elem != NULL) {
            info = (char **) elem->q_data;          
This page took 0.042227 seconds and 4 git commands to generate.