diff options
author | Mathieu Sauve-Frankel <msf@cvs.openbsd.org> | 2006-12-24 05:01:09 +0000 |
---|---|---|
committer | Mathieu Sauve-Frankel <msf@cvs.openbsd.org> | 2006-12-24 05:01:09 +0000 |
commit | 5b3758d3b563d35b683d3f25eb043c7752578d25 (patch) | |
tree | 3da796b7dd5a7a1446eafa78ea4c8ae9e349de94 /usr.sbin/sasyncd/conf.y | |
parent | f9ae506d0111c639aec85b25d95f5d508675f6bd (diff) |
first pass cleanup of sasyncd, based on some discussion with deraadt@
inline conf_init into main() and remove it from conf.y. add usage().
small amount of whitespace nits in sasync.h
ok deraadt@ mcbride@
Diffstat (limited to 'usr.sbin/sasyncd/conf.y')
-rw-r--r-- | usr.sbin/sasyncd/conf.y | 54 |
1 files changed, 2 insertions, 52 deletions
diff --git a/usr.sbin/sasyncd/conf.y b/usr.sbin/sasyncd/conf.y index e958d001011..d32a5043865 100644 --- a/usr.sbin/sasyncd/conf.y +++ b/usr.sbin/sasyncd/conf.y @@ -1,4 +1,4 @@ -/* $OpenBSD: conf.y,v 1.11 2006/06/02 20:31:48 moritz Exp $ */ +/* $OpenBSD: conf.y,v 1.12 2006/12/24 05:01:08 msf Exp $ */ /* * Copyright (c) 2005 Håkan Olsson. All rights reserved. @@ -269,7 +269,7 @@ yylex(void) return v; } -static int +int conf_parse_file(char *cfgfile) { struct stat st; @@ -342,56 +342,6 @@ conf_parse_file(char *cfgfile) return 1; } -int -conf_init(int argc, char **argv) -{ - char *cfgfile = 0; - int ch; - - memset(&cfgstate, 0, sizeof cfgstate); - cfgstate.runstate = INIT; - LIST_INIT(&cfgstate.peerlist); - - cfgstate.listen_port = SASYNCD_DEFAULT_PORT; - - while ((ch = getopt(argc, argv, "c:dv")) != -1) { - switch (ch) { - case 'c': - if (cfgfile) - return 2; - cfgfile = optarg; - break; - case 'd': - cfgstate.debug++; - break; - case 'v': - cfgstate.verboselevel++; - break; - default: - return 2; - } - } - argc -= optind; - argv += optind; - - if (argc > 0) - return 2; - - if (!cfgfile) - cfgfile = SASYNCD_CFGFILE; - - if (conf_parse_file(cfgfile) == 0) { - if (!cfgstate.sharedkey) { - fprintf(stderr, "config: " - "no shared key specified, cannot continue"); - return 1; - } - return 0; - } - - return 1; -} - void yyerror(const char *s) { |