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>
19 #define UBIK_INTERNALS
23 * This file contain useful subroutines for parsing command line args for ubik
27 ubik_ParseServerList(int argc
, char **argv
, afs_uint32
*ahost
,
34 afs_uint32 myHost
, temp
;
36 int inServer
, sawServer
;
38 gethostname(hostname
, sizeof(hostname
));
39 th
= gethostbyname(hostname
);
42 memcpy(&myHost
, th
->h_addr
, sizeof(afs_uint32
));
45 inServer
= 0; /* haven't seen -servers yet */
48 for (i
= 1; i
< argc
; i
++) {
49 /* look for -servers argument */
56 /* otherwise this is a new host name */
57 th
= gethostbyname(tp
);
60 memcpy(&temp
, th
->h_addr
, sizeof(afs_uint32
));
62 if (counter
++ >= MAXSERVERS
)
68 /* haven't seen a -server yet */
69 if (!strcmp(tp
, "-servers")) {
72 } else if (!strcmp(tp
, "-dubik")) {
77 /* never saw a -server */
80 if (counter
< MAXSERVERS
)
81 *aothers
++ = 0; /* null terminate if there's room */