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>
14 #include <sys/types.h>
23 #include <netinet/in.h>
24 #include <sys/param.h>
31 #define UBIK_INTERNALS
35 * This file contain useful subroutines for parsing command line args for ubik
39 ubik_ParseServerList(int argc, char **argv, afs_int32 *ahost,
44 register struct hostent *th;
46 afs_int32 myHost, temp, counter;
47 int inServer, sawServer;
49 gethostname(hostname, sizeof(hostname));
50 th = gethostbyname(hostname);
53 memcpy(&myHost, th->h_addr, sizeof(afs_int32));
56 inServer = 0; /* haven't seen -servers yet */
59 for (i = 1; i < argc; i++) {
60 /* look for -servers argument */
67 /* otherwise this is a new host name */
68 th = gethostbyname(tp);
71 memcpy(&temp, th->h_addr, sizeof(afs_int32));
73 if (counter++ >= MAXSERVERS)
79 /* haven't seen a -server yet */
80 if (!strcmp(tp, "-servers")) {
83 } else if (!strcmp(tp, "-dubik")) {
88 /* never saw a -server */
91 if (counter < MAXSERVERS)
92 *aothers++ = 0; /* null terminate if there's room */