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>
16 #include <sys/types.h>
21 #include <netinet/in.h>
22 #include <sys/param.h>
37 #define UBIK_INTERNALS
40 /* This file contain useful subroutines for parsing command line args for ubik
44 ubik_ParseServerList(argc, argv, ahost, aothers)
52 register struct hostent *th;
54 afs_int32 myHost, temp, counter;
55 int inServer, sawServer;
57 gethostname(hostname, sizeof(hostname));
58 th = gethostbyname(hostname);
61 memcpy(&myHost, th->h_addr, sizeof(afs_int32));
64 inServer = 0; /* haven't seen -servers yet */
67 for (i = 1; i < argc; i++) {
68 /* look for -servers argument */
75 /* otherwise this is a new host name */
76 th = gethostbyname(tp);
79 memcpy(&temp, th->h_addr, sizeof(afs_int32));
81 if (counter++ >= MAXSERVERS)
87 /* haven't seen a -server yet */
88 if (!strcmp(tp, "-servers")) {
91 } else if (!strcmp(tp, "-dubik")) {
96 /* never saw a -server */
99 if (counter < MAXSERVERS)
100 *aothers++ = 0; /* null terminate if there's room */