-#if (!defined(lint) && !defined(SABER))
- static char rcsid_module_c[] = "$Header$";
-#endif
-
-/* This is the file nfs.c for the Moira Client, which allows users
+/* $Id$
+ *
+ * This is the file nfs.c for the Moira Client, which allows users
* to quickly and easily maintain most parts of the Moira database.
* It Contains: All functions for manipulating NFS Physical directories.
*
* Created: 5/6/88
* By: Chris D. Peterson
*
- * $Source$
- * $Author$
- * $Header$
- *
- * Copyright 1988 by the Massachusetts Institute of Technology.
- *
- * For further information on copyright and distribution
- * see the file mit-copyright.h
+ * Copyright (C) 1988-1998 by the Massachusetts Institute of Technology.
+ * For copying and distribution information, please see the file
+ * <mit-copyright.h>.
*/
-#include <stdio.h>
-#include <string.h>
+#include <mit-copyright.h>
#include <moira.h>
#include <moira_site.h>
-#include <menu.h>
-
-#include "mit-copyright.h"
#include "defs.h"
#include "f_defs.h"
#include "globals.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+RCSID("$Header$");
+
+char **AskNFSInfo(char **info);
#define TYPE_NFS "NFS"
{
char temp_buf[BUFSIZ];
sprintf(temp_buf, "Machine %s Directory %s", info[NFS_NAME], info[NFS_DIR]);
- return Strsave(temp_buf); /* Small memory leak here, but no good way
+ return strdup(temp_buf); /* Small memory leak here, but no good way
to avoid it that I see. */
}
int ShowNFSService(int argc, char **argv)
{
int stat;
- struct qelem *elem = NULL;
+ struct mqelem *elem = NULL;
char *args[10];
if (!ValidName(argv[1]))
return DM_NORMAL;
- args[0] = canonicalize_hostname(strsave(argv[1]));
- args[1] = strsave(DEFAULT_DIR);
+ args[0] = canonicalize_hostname(strdup(argv[1]));
+ args[1] = strdup(DEFAULT_DIR);
if (GetValueFromUser("Directory:", &args[1]) == SUB_ERROR)
return DM_NORMAL;
- if ((stat = do_mr_query("get_nfsphys", 2, args,
- StoreInfo, &elem)))
+ if ((stat = do_mr_query("get_nfsphys", 2, args, StoreInfo, &elem)))
com_err(program_name, stat, " in ShowNFSServices.");
free(args[0]);
free(args[1]); /* prevents memory leaks. */
elem = QueueTop(elem);
- Loop(elem, (void *) PrintNFSInfo);
+ Loop(elem, (void (*)(char **)) PrintNFSInfo);
FreeQueue(elem);
return DM_NORMAL;
char *info[MAX_ARGS_SIZE];
int stat;
- args[0] = canonicalize_hostname(strsave(argv[1]));
- args[1] = strsave(DEFAULT_DIR);
+ args[0] = canonicalize_hostname(strdup(argv[1]));
+ args[1] = strdup(DEFAULT_DIR);
if (GetValueFromUser("Directory:", &args[1]) == SUB_ERROR)
return DM_NORMAL;
if (!ValidName(args[0]) || !ValidName(args[1]))
return DM_NORMAL;
- if (!(stat = do_mr_query("get_nfsphys", 2, args, NullFunc, NULL)))
+ if (!(stat = do_mr_query("get_nfsphys", 2, args, NULL, NULL)))
stat = MR_EXISTS;
if (stat != MR_NO_MATCH)
{
return DM_NORMAL;
}
- info[NFS_NAME] = Strsave(args[0]);
+ info[NFS_NAME] = strdup(args[0]);
info[NFS_DIR] = args[1]; /* already saved. */
- info[NFS_DEVICE] = Strsave(DEFAULT_DEVICE);
- info[NFS_STATUS] = Strsave(DEFAULT_STATUS);
- info[NFS_ALLOC] = Strsave(DEFAULT_ALLOC);
- info[NFS_SIZE] = Strsave(DEFAULT_SIZE);
+ info[NFS_DEVICE] = strdup(DEFAULT_DEVICE);
+ info[NFS_STATUS] = strdup(DEFAULT_STATUS);
+ info[NFS_ALLOC] = strdup(DEFAULT_ALLOC);
+ info[NFS_SIZE] = strdup(DEFAULT_SIZE);
info[NFS_MODBY] = info[NFS_MODWITH] = info[NFS_MODTIME] = NULL;
info[NFS_END] = NULL;
}
if ((stat = do_mr_query("add_nfsphys", CountArgs(add_args), add_args,
- Scream, NULL)))
+ NULL, NULL)))
com_err(program_name, stat, " in AdsNFSService");
FreeInfo(info);
}
if ((stat = do_mr_query("update_nfsphys", CountArgs(args), args,
- Scream, NULL)))
+ NULL, NULL)))
com_err(program_name, stat, " in RealUpdateNFSService");
}
int UpdateNFSService(int argc, char **argv)
{
int stat;
- struct qelem *elem = NULL;
+ struct mqelem *elem = NULL;
char *args[10];
if (!ValidName(argv[1]))
return DM_NORMAL;
- args[0] = canonicalize_hostname(strsave(argv[1]));
- args[1] = strsave(DEFAULT_DIR);
+ args[0] = canonicalize_hostname(strdup(argv[1]));
+ args[1] = strdup(DEFAULT_DIR);
if (GetValueFromUser("Directory:", &args[1]) == SUB_ERROR)
return DM_NORMAL;
- if ((stat = do_mr_query("get_nfsphys", 2, args, StoreInfo, (char *) &elem)))
+ if ((stat = do_mr_query("get_nfsphys", 2, args, StoreInfo, &elem)))
{
com_err(program_name, stat, " in UpdateNFSService.");
return DM_NORMAL;
static void RealDeleteNFSService(char **info, Bool one_item)
{
char temp_buf[BUFSIZ], *args[10];
- struct qelem *elem = NULL;
+ struct mqelem *elem = NULL;
int stat;
sprintf(temp_buf,
args[1] = info[NFS_DIR];
args[2] = NULL;
switch ((stat = do_mr_query("get_filesys_by_nfsphys", CountArgs(args),
- args, StoreInfo, (char *)&elem)))
+ args, StoreInfo, &elem)))
{
case MR_NO_MATCH: /* it is unused, delete it. */
- if ((stat = do_mr_query("delete_nfsphys", 2, info, Scream, NULL)))
+ if ((stat = do_mr_query("delete_nfsphys", 2, info, NULL, NULL)))
com_err(program_name, stat, " in DeleteNFSService");
else
Put_message("Physical Filesystem Deleted.");
int DeleteNFSService(int argc, char **argv)
{
int stat;
- struct qelem *elem = NULL;
+ struct mqelem *elem = NULL;
char *args[10];
if (!ValidName(argv[1]))
return DM_NORMAL;
- args[0] = canonicalize_hostname(strsave(argv[1]));
- args[1] = strsave(DEFAULT_DIR);
+ args[0] = canonicalize_hostname(strdup(argv[1]));
+ args[1] = strdup(DEFAULT_DIR);
if (GetValueFromUser("Directory:", &args[1]) == SUB_ERROR)
return DM_NORMAL;
- switch ((stat = do_mr_query("get_nfsphys", 2, args,
- StoreInfo, (char *) &elem)))
+ switch ((stat = do_mr_query("get_nfsphys", 2, args, StoreInfo, &elem)))
{
case MR_NO_MATCH:
Put_message("This filsystem does not exist!");