-/* This is the file misc.c for the Moira Client, which allows a naieve
+/* $Id$
+ *
+ * This is the file misc.c for the Moira Client, which allows a naieve
* to quickly and easily maintain most parts of the Moira database.
* It Contains:
* TableStats
* Created: 5 October 1988
* By: Mark A. Rosenstein
*
- * $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 "defs.h"
+#include "f_defs.h"
+#include "globals.h"
+
#include <sys/types.h>
-#include <netdb.h>
+#ifndef _WIN32
#include <sys/socket.h>
#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <netdb.h>
+#endif /* _WIN32 */
-#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$");
+void PrintStats(char **info);
+void PrintClients(char **info);
+void PrintValue(char **info);
+void PrintAlias(char **info);
/* Function Name: PrintStats
* Description: print statistics from argv
* Returns: DM_NORMAL
*/
-int PrintStats(char **info)
+void PrintStats(char **info)
{
char buf[BUFSIZ];
- sprintf(buf, "Table: %-30s Modified: %s", info[0], info[5]);
+ sprintf(buf, "Table: %-30s Modified: %s", info[0], info[4]);
Put_message(buf);
sprintf(buf, " %s appends, %s updates, %s deletes",
- info[2], info[3], info[4]);
+ info[1], info[2], info[3]);
Put_message(buf);
}
* Returns: DM_NORMAL
*/
-int TableStats(void)
+int TableStats(int argc, char **argv)
{
int status;
- struct qelem *elem = NULL;
+ struct mqelem *elem = NULL;
- if ((status = do_mr_query("get_all_table_stats", 0, NULL,
- StoreInfo, (char *)&elem)))
+ if ((status = do_mr_query("get_all_table_stats", 0, NULL, StoreInfo, &elem)))
{
com_err(program_name, status, " in TableStats");
return DM_NORMAL;
* Arguments: argv
*/
-int PrintClients(char **info)
+void PrintClients(char **info)
{
char buf[BUFSIZ];
unsigned long host_address;
if (host_entry)
{
free(info[1]);
- info[1] = Strsave(host_entry->h_name);
+ info[1] = strdup(host_entry->h_name);
}
}
sprintf(buf, "Principal %s on %s (%s)", info[0], info[1], info[2]);
* Returns: DM_NORMAL
*/
-int ShowClients(void)
+int ShowClients(int argc, char **argv)
{
int status;
- struct qelem *elem = NULL;
+ struct mqelem *elem = NULL;
- if ((status = do_mr_query("_list_users", 0, NULL,
- StoreInfo, (char *) &elem)))
+ if ((status = do_mr_query("_list_users", 0, NULL, StoreInfo, &elem)))
{
com_err(program_name, status, " in ShowClients");
return DM_NORMAL;
* Arguments: argv
*/
-int PrintValue(char **info)
+void PrintValue(char **info)
{
char buf[BUFSIZ];
int ShowValue(int argc, char **argv)
{
int status;
- struct qelem *elem = NULL;
+ struct mqelem *elem = NULL;
- if ((status = do_mr_query("get_value", 1, &argv[1],
- StoreInfo, (char *) &elem)))
+ if ((status = do_mr_query("get_value", 1, &argv[1], StoreInfo, &elem)))
{
com_err(program_name, status, " in ShowValue");
return DM_NORMAL;
* Arguments: argv
*/
-int PrintAlias(char **info)
+void PrintAlias(char **info)
{
char buf[BUFSIZ];
{
int status;
char *info[4];
- struct qelem *elem = NULL;
+ struct mqelem *elem = NULL;
info[0] = argv[1];
info[1] = argv[2];
info[2] = "*";
- if ((status = do_mr_query("get_alias", 3, info,
- StoreInfo, (char *) &elem)))
+ if ((status = do_mr_query("get_alias", 3, info, StoreInfo, &elem)))
{
com_err(program_name, status, " in ShowAlias");
return DM_NORMAL;