diff options
author | Herb Lewis <herb@samba.org> | 1998-11-19 21:17:58 +0000 |
---|---|---|
committer | Herb Lewis <herb@samba.org> | 1998-11-19 21:17:58 +0000 |
commit | 735631539ca8ab74056894b653a8fee785262854 (patch) | |
tree | 980fe86bc797a48cd992227febfb965c2d2652da /source3/utils | |
parent | e204f1d8a3f54cb6bd8549b15a59af9a525b3392 (diff) | |
download | samba-735631539ca8ab74056894b653a8fee785262854.tar.gz samba-735631539ca8ab74056894b653a8fee785262854.tar.bz2 samba-735631539ca8ab74056894b653a8fee785262854.zip |
update testparm with -s option so it doesn't require a carriage return
also allow specifying [host hostip] without [configfile]
updated man page
(This used to be commit 85fbd401026e7f1464c9a125cbaa505b768f8a10)
Diffstat (limited to 'source3/utils')
-rw-r--r-- | source3/utils/testparm.c | 44 |
1 files changed, 34 insertions, 10 deletions
diff --git a/source3/utils/testparm.c b/source3/utils/testparm.c index 92bf5cb384..9bf741e24f 100644 --- a/source3/utils/testparm.c +++ b/source3/utils/testparm.c @@ -72,8 +72,12 @@ cannot be set in the smb.conf file. nmbd will abort with this setting.\n"); int main(int argc, char *argv[]) { + extern char *optarg; + extern int optind; pstring configfile; + int opt; int s; + BOOL silent_mode = False; TimeInit(); @@ -81,10 +85,20 @@ cannot be set in the smb.conf file. nmbd will abort with this setting.\n"); charset_initialise(); - if (argc < 2) + while ((opt = getopt(argc, argv,"s")) != EOF) { + switch (opt) { + case 's': + silent_mode = True; + break; + } + } + + argc += (1 - optind); + + if ((argc == 1) || (argc == 3)) pstrcpy(configfile,CONFIGFILE); - else - pstrcpy(configfile,argv[1]); + else if ((argc == 2) || (argc == 4)) + pstrcpy(configfile,argv[optind]); dbf = stdout; DEBUGLEVEL = 2; @@ -116,19 +130,29 @@ cannot be set in the smb.conf file. nmbd will abort with this setting.\n"); break; } - if (argc < 4) + if (argc < 3) { - printf("Press enter to see a dump of your service definitions\n"); - fflush(stdout); - getc(stdin); + if (!silent_mode) { + printf("Press enter to see a dump of your service definitions\n"); + fflush(stdout); + getc(stdin); + } lp_dump(stdout,True); } - if (argc == 4) + if (argc >= 3) { - char *cname = argv[2]; - char *caddr = argv[3]; + char *cname; + char *caddr; + if (argc == 3) { + cname = argv[optind]; + caddr = argv[optind+1]; + } else if (argc == 4) { + cname = argv[optind+1]; + caddr = argv[optind+2]; + } + /* this is totally ugly, a real `quick' hack */ for (s=0;s<1000;s++) if (VALID_SNUM(s)) |