-/* $Id $
+/* $Id$
*
* This is the file utils.c for the Moira Client, which allows users
* to quickly and easily maintain most parts of the Moira database.
#include "f_defs.h"
#include "globals.h"
+#include <sys/types.h>
+
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h> /* for gethostbyname. */
* Returns: none.
*/
-static void AddQueue(struct qelem *elem, struct qelem *pred)
+static void AddQueue(struct mqelem *elem, struct mqelem *pred)
{
if (!pred)
{
* Returns: none.
*/
-static void RemoveQueue(struct qelem *elem)
+static void RemoveQueue(struct mqelem *elem)
{
if (elem->q_forw)
elem->q_forw->q_back = elem->q_back;
}
/* Function Name: QueueTop
- * Description: returns a qelem pointer that points to the top of
+ * Description: returns a mqelem pointer that points to the top of
* a queue.
* Arguments: elem - any element of a queue.
* Returns: top element of a queue.
*/
-struct qelem *QueueTop(struct qelem *elem)
+struct mqelem *QueueTop(struct mqelem *elem)
{
if (!elem) /* NULL returns NULL. */
return NULL;
* Returns: none
*/
-static void FreeQueueElem(struct qelem *elem)
+static void FreeQueueElem(struct mqelem *elem)
{
char **info = elem->q_data;
* Returns: none.
*/
-void FreeQueue(struct qelem *elem)
+void FreeQueue(struct mqelem *elem)
{
- struct qelem *temp, *local = QueueTop(elem);
+ struct mqelem *temp, *local = QueueTop(elem);
while (local)
{
* Returns: none.
*/
-int QueueCount(struct qelem *elem)
+int QueueCount(struct mqelem *elem)
{
int count = 0;
elem = QueueTop(elem);
* Arguments: argc, argv, - information returned from the query returned
* in argv.
* data - the previous element on the queue, this data will be
- * stored in a qelem struct immediatly after this elem.
+ * stored in a mqelem struct immediatly after this elem.
* If NULL then a new queue will be created. This value
* is updated to the current element at the end off the
* call.
int StoreInfo(int argc, char **argv, void *data)
{
char **info = malloc(MAX_ARGS_SIZE * sizeof(char *));
- struct qelem **old_elem = data;
- struct qelem *new_elem = malloc(sizeof(struct qelem));
+ struct mqelem **old_elem = data;
+ struct mqelem *new_elem = malloc(sizeof(struct mqelem));
int count;
if (!new_elem || !info)
verbose = !verbose;
if (verbose)
- Put_message("Delete functions will first confirm\n");
+ Put_message("Delete functions will first confirm");
else
- Put_message("Delete functions will be silent\n");
+ Put_message("Delete functions will be silent");
return DM_NORMAL;
}
* Returns: none.
*/
-void Loop(struct qelem *elem, void (*func)(char **))
+void Loop(struct mqelem *elem, void (*func)(char **))
{
while (elem)
{
* "Delete the list"
*/
-void QueryLoop(struct qelem *elem, char * (*print_func)(char **),
+void QueryLoop(struct mqelem *elem, char * (*print_func)(char **),
void (*op_func)(char **, Bool), char *query_string)
{
Bool one_item;
* Returns: argv of values
*/
-struct qelem *GetTypeValues(char *tname)
+struct mqelem *GetTypeValues(char *tname)
{
int stat;
char *argv[3], *p, **pp;
- struct qelem *elem, *oelem;
- static struct qelem *cache = NULL;
+ struct mqelem *elem, *oelem;
+ static struct mqelem *cache = NULL;
struct cache_elem {
char *cache_name;
- struct qelem *cache_data;
+ struct mqelem *cache_data;
} *ce;
for (elem = cache; elem; elem = elem->q_forw)
FreeInfo(pp);
elem->q_data = p;
}
- elem = malloc(sizeof(struct qelem));
+ elem = malloc(sizeof(struct mqelem));
ce = malloc(sizeof(struct cache_elem));
ce->cache_name = strdup(tname);
ce->cache_data = QueueTop(oelem);
int GetTypeFromUser(char *prompt, char *tname, char **pointer)
{
char def[BUFSIZ], buffer[BUFSIZ], *p, *argv[3];
- struct qelem *elem;
+ struct mqelem *elem;
int stat;
strcpy(def, *pointer);
com_err(program_name, stat, " in add_alias");
else
{
- elem = malloc(sizeof(struct qelem));
+ elem = malloc(sizeof(struct mqelem));
elem->q_data = strdup(*pointer);
AddQueue(elem, GetTypeValues(tname));
Put_message("Done.");