2 * Copyright 2000, International Business Machines Corporation and others.
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
10 #include <afsconfig.h>
11 #include <afs/param.h>
15 #include <sys/types.h>
24 #include <netinet/in.h>
25 #include <sys/param.h>
32 #define UBIK_INTERNALS
36 * This file contain useful subroutines for parsing command line args for ubik
40 ubik_ParseServerList(int argc, char **argv, afs_uint32 *ahost,
47 afs_uint32 myHost, temp;
49 int inServer, sawServer;
51 gethostname(hostname, sizeof(hostname));
52 th = gethostbyname(hostname);
55 memcpy(&myHost, th->h_addr, sizeof(afs_uint32));
58 inServer = 0; /* haven't seen -servers yet */
61 for (i = 1; i < argc; i++) {
62 /* look for -servers argument */
69 /* otherwise this is a new host name */
70 th = gethostbyname(tp);
73 memcpy(&temp, th->h_addr, sizeof(afs_uint32));
75 if (counter++ >= MAXSERVERS)
81 /* haven't seen a -server yet */
82 if (!strcmp(tp, "-servers")) {
85 } else if (!strcmp(tp, "-dubik")) {
90 /* never saw a -server */
93 if (counter < MAXSERVERS)
94 *aothers++ = 0; /* null terminate if there's room */