*/
#include <stdio.h>
-#include <strings.h>
+#include <string.h>
#include <moira.h>
#include <moira_site.h>
#include <menu.h>
#include "defs.h"
#include "f_defs.h"
#include "globals.h"
-
#include <netdb.h> /* for gethostbyname. */
+#include <sys/types.h>
+#include <netinet/in.h>
+
/* Function Name: AddQueue
* Description: Adds an element to a queue
{
if (IS_EMPTY(s))
Put_message("Please use a non-empty name.");
- else if (index(s, ' '))
+ else if (strchr(s, ' '))
Put_message("You cannot use space (' ') in this name.");
- else if (index(s, '*') || index(s, '?') || index(s, '['))
+ else if (strchr(s, '*') || strchr(s, '?') || strchr(s, '['))
Put_message("Wildcards not accepted here.");
else
return TRUE;
* a difference that makes no difference, IS no difference.
*/
- if (strcmp(buf, *pointer) != 0) {
- if (*pointer != NULL)
+ if (*pointer != NULL) {
+ if (strcmp(buf, *pointer) != 0) {
free(*pointer);
- *pointer = Strsave(buf);
+ *pointer = Strsave(buf);
+ }
}
return(SUB_NORMAL);
}
return (strcpy(newstr, str));
}
+
+/* atot: convert ASCII integer unix time into human readable date string */
+
+char *atot(itime)
+char *itime;
+{
+ int time;
+ char *ct, *ctime();
+
+ time = atoi(itime);
+ ct = ctime(&time);
+ ct[24] = 0;
+ return(&ct[4]);
+}
+
+
/* Function Name: Print
* Description: prints out all the arguments on a single line.
* Arguments: argc, argv - the standard MR arguments.
}
+/* Function Name: GetAddressFromUser
+ * Description: gets an IP address from the user
+ * Arguments: prompt string, buffer pointer
+ * buffer contains default value as long int
+ * Returns: SUB_ERROR if ^C, SUB_NORMAL otherwise
+ */
+
+int GetAddressFromUser(prompt, pointer)
+char *prompt;
+char **pointer;
+{
+ char *value, buf[256];
+ struct in_addr addr;
+ int ret;
+
+ addr.s_addr = htonl(atoi(*pointer));
+ value = strsave(inet_ntoa(addr));
+ ret = GetValueFromUser(prompt, &value);
+ if (ret == SUB_ERROR) return(SUB_ERROR);
+ addr.s_addr = inet_addr(value);
+ free(pointer);
+ sprintf(buf, "%d", ntohl(addr.s_addr));
+ *pointer = strsave(buf);
+ return(SUB_NORMAL);
+}
+
+
do_mr_query(name, argc, argv, proc, hint)
char *name;
int argc;