2 * rconfig - Remote configurator
4 * rconfig [-W workingdir] [server_ip[:tag]]
5 * rconfig [-f configfile] -s
7 * $DragonFly: src/sbin/rconfig/rconfig.c,v 1.2 2004/06/18 04:26:53 dillon Exp $
12 const char *WorkDir
= "/tmp";
13 const char *ConfigFiles
= "/etc/defaults/rconfig.conf:/etc/rconfig.conf";
14 const char *TagDir
= "/usr/local/etc/rconfig";
19 static void usage(int code
);
20 static void addTag(tag_t
*basep
, const char *tag
, int flags
);
23 main(int ac
, char **av
)
29 while ((ch
= getopt(ac
, av
, "aD:W:irt:f:sv")) != -1) {
31 case 'a': /* auto tag / standard broadcast */
32 addTag(&AddrBase
, NULL
, 0);
34 case 'W': /* specify working directory */
40 case 'C': /* specify server config file(s) (colon delimited) */
43 case 's': /* run as server using config file */
54 for (i
= optind
; i
< ac
; ++i
) {
55 if (strchr(av
[i
], '='))
56 addTag(&VarBase
, av
[i
], 0);
58 addTag(&AddrBase
, av
[i
], 0);
62 if (AddrBase
&& AddrBase
->name
== NULL
&& AddrBase
->next
) {
64 "You cannot specify both -a AND a list of hosts. If you want\n"
65 "to use auto-broadcast mode with a tag other then 'auto',\n"
66 "just specify the tag without a host, e.g. ':<tag>'\n");
78 addTag(tag_t
*basep
, const char *name
, int flags
)
80 tag_t tag
= calloc(sizeof(struct tag
), 1);
82 while ((*basep
) != NULL
)
83 basep
= &(*basep
)->next
;
93 fprintf(stderr
, "rconfig [-W workdir] [-f servconfig] "
94 "[-s] [var=data]* [server_ip[:tag]]* \n");