-#if (!defined(lint) && !defined(SABER))
- static char rcsid_module_c[] = "$Header$";
-#endif
-
-/* This is the file quota.c for the Moira Client, which allows users
+/* $Id $
+ *
+ * This is the file quota.c for the Moira Client, which allows users
* to quickly and easily maintain most parts of the Moira database.
* It Contains: Functions for manipulating the quota information.
*
* Created: 7/10/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 <stdlib.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>
+
+int afsfilsyshelper(int argc, char **argv, void *hint);
+int afsfilesys(char *name);
+
static char *def_quota = NULL;
#define DEFAULT_FILESYS DEFAULT_NONE
if (override || (def_quota == NULL))
{
if ((status = do_mr_query("get_value", CountArgs(val), val,
- StoreInfo, (char *) &top)))
+ StoreInfo, &top)))
{
com_err(program_name, status, " in ShowDefaultQuota");
if (!def_quota)
{
Put_message("No default Quota Found, setting default to 0.");
- def_quota = Strsave("0");
+ def_quota = strdup("0");
}
else
Put_message("No default Quota Found, retaining old value.");
else
{
top = QueueTop(top);
- info = (char **) top->q_data;
+ info = top->q_data;
FreeAndClear(&def_quota, TRUE);
- def_quota = Strsave(info[0]);
+ def_quota = strdup(info[0]);
FreeQueue(top);
}
}
}
-int afsfilsyshelper(int argc, char **argv, int *hint)
+int afsfilsyshelper(int argc, char **argv, void *hint)
{
- *hint = !strcmp(argv[FS_TYPE], "AFS");
- return 0;
+ *(int *)hint = !strcmp(argv[FS_TYPE], "AFS");
+ return MR_CONT;
}
return NULL;
}
- args[Q_FILESYS] = Strsave(DEFAULT_FILESYS);
- args[Q_TYPE] = Strsave(DEFAULT_QTYPE);
- args[Q_NAME] = Strsave(DEFAULT_USER);
+ args[Q_FILESYS] = strdup(DEFAULT_FILESYS);
+ args[Q_TYPE] = strdup(DEFAULT_QTYPE);
+ args[Q_NAME] = strdup(DEFAULT_USER);
if (quota)
{
- args[Q_QUOTA] = Strsave(GetDefaultUserQuota(FALSE));
+ args[Q_QUOTA] = strdup(GetDefaultUserQuota(FALSE));
args[Q_QUOTA + 1] = NULL; /* NULL terminate. */
}
else
}
if (af)
{
- args[Q_TYPE] = strsave("ANY");
- args[Q_NAME] = strsave(NOBODY);
+ args[Q_TYPE] = strdup("ANY");
+ args[Q_NAME] = strdup(NOBODY);
}
else
{
* Returns: DM_NORMAL.
*/
-int ShowDefaultQuota(void)
+int ShowDefaultQuota(int argc, char **argv)
{
PrintDefaultQuota(GetDefaultUserQuota(TRUE));
return DM_NORMAL;
{
newval[1] = argv[1];
if ((status = do_mr_query("update_value", CountArgs(newval),
- newval, Scream, NULL)) == MR_SUCCESS)
+ newval, NULL, NULL)) == MR_SUCCESS)
{
FreeAndClear(&def_quota, TRUE);
- def_quota = Strsave(argv[1]);
+ def_quota = strdup(argv[1]);
}
else
com_err(program_name, status, " in update_value");
* Returns: DM_NORMAL
*/
-int GetQuota(void)
+int GetQuota(int argc, char **argv)
{
struct qelem *top = NULL;
int status;
return DM_NORMAL;
if ((status = do_mr_query("get_quota", CountArgs(args), args,
- StoreInfo, (char *) &top)) != MR_SUCCESS)
+ StoreInfo, &top)) != MR_SUCCESS)
com_err(program_name, status, " in get_quota");
FreeInfo(args);
* Returns: DM_NORMAL
*/
-int GetQuotaByFilesys(void)
+int GetQuotaByFilesys(int argc, char **argv)
{
struct qelem *top = NULL;
int status;
return DM_NORMAL;
}
- args[0] = Strsave("");
+ args[0] = strdup("");
args[1] = NULL;
if (GetValueFromUser("Filesystem", &args[0]) == SUB_ERROR)
return DM_NORMAL;
if ((status = do_mr_query("get_quota_by_filesys", 1, args,
- StoreInfo, (char *) &top)) != MR_SUCCESS)
+ StoreInfo, &top)) != MR_SUCCESS)
com_err(program_name, status, " in get_quota_by_filesys");
FreeInfo(args);
* Arguments: None
* Returns: DM_NORMAL
*/
-int AddQuota(void)
+int AddQuota(int argc, char **argv)
{
char **args;
int status;
return DM_NORMAL;
if ((status = do_mr_query("add_quota", CountArgs(args), args,
- Scream, NULL)) != MR_SUCCESS)
+ NULL, NULL)) != MR_SUCCESS)
com_err(program_name, status, " in add_quota");
FreeInfo(args);
return;
}
- if (status = do_mr_query("update_quota", 4, info,
- Scream, NULL) != MR_SUCCESS)
- {
+ if ((status = do_mr_query("update_quota", 4, info,
+ NULL, NULL)) != MR_SUCCESS)
+ {
com_err(program_name, status, " in update_quota");
sprintf(temp_buf, "Could not perform quota change on %s",
info[Q_FILESYS]);
* Returns: DM_NORMAL
*/
-int UpdateQuota(void)
+int UpdateQuota(int argc, char **argv)
{
int status;
char **args;
return DM_NORMAL;
if ((status = do_mr_query("get_quota", CountArgs(args), args,
- StoreInfo, (char *) &top)) != MR_SUCCESS)
+ StoreInfo, &top)) != MR_SUCCESS)
com_err(program_name, status, " in get_quota");
FreeInfo(args); /* done with args, free them. */
if (!one_item || Confirm(temp_buf))
{
if ((status = do_mr_query("delete_quota", 3, info,
- Scream, NULL)) != MR_SUCCESS)
+ NULL, NULL)) != MR_SUCCESS)
com_err(program_name, status, " in delete_quota");
else
Put_message("Quota sucessfully removed.");
* Returns: DM_NORMAL
*/
-int DeleteQuota(void)
+int DeleteQuota(int argc, char **argv)
{
int status;
char **args;
if (!(args = GetQuotaArgs(FALSE)))
return DM_NORMAL;
- if ((status = do_mr_query("get_quota", 3, args,
- StoreInfo, (char *) &top)))
+ if ((status = do_mr_query("get_quota", 3, args, StoreInfo, &top)))
com_err(program_name, status, " in get_quota");
FreeInfo(args);