diff options
-rw-r--r-- | docs/htmldocs/testparm.1.html | 6 | ||||
-rw-r--r-- | docs/manpages/testparm.1 | 7 | ||||
-rw-r--r-- | docs/yodldocs/testparm.1.yo | 7 | ||||
-rw-r--r-- | source3/utils/testparm.c | 44 |
4 files changed, 51 insertions, 13 deletions
diff --git a/docs/htmldocs/testparm.1.html b/docs/htmldocs/testparm.1.html index cd7b08232a..6d2c2c92c5 100644 --- a/docs/htmldocs/testparm.1.html +++ b/docs/htmldocs/testparm.1.html @@ -24,7 +24,7 @@ <p><br><a name="SYNOPSIS"></a> <h2>SYNOPSIS</h2> -<p><br><strong>testparm</strong> [<a href="testparm.1.html#configfilename">configfilename</a> [<a href="testparm.1.html#hostname">hostname</a> <a href="testparm.1.html#hostIP">hostIP</a>] ] +<p><br><strong>testparm</strong> [<a href="testparm.1.html#minuss">-s</a>] [<a href="testparm.1.html#configfilename">configfilename</a>] [<a href="testparm.1.html#hostname">hostname</a> <a href="testparm.1.html#hostIP">hostIP</a>] <p><br><a name="DESCRIPTION"></a> <h2>DESCRIPTION</h2> @@ -43,6 +43,10 @@ reporting whether the specified host has access to each service. <h2>OPTIONS</h2> <p><br><ul> +<p><br><a name="minuss"></a> +<li><strong><strong>-s</strong></strong> Without this option, <strong>testparm</strong> will prompt for a +carriage return after printing the service names and before dumping +the service definitions. <p><br><a name="configfilename"></a> <li><strong><strong>configfilename</strong></strong> This is the name of the configuration file to check. If this parameter is not present then the default diff --git a/docs/manpages/testparm.1 b/docs/manpages/testparm.1 index 92ba093ded..725b5863b6 100644 --- a/docs/manpages/testparm.1 +++ b/docs/manpages/testparm.1 @@ -5,7 +5,7 @@ testparm \- check an smb\&.conf configuration file for internal correctness .PP .SH "SYNOPSIS" .PP -\fBtestparm\fP [configfilename [hostname hostIP] ] +\fBtestparm\fP [-s] [configfilename] [hostname hostIP] .PP .SH "DESCRIPTION" .PP @@ -27,6 +27,11 @@ reporting whether the specified host has access to each service\&. .SH "OPTIONS" .PP .IP +.IP "\fB-s\fP" +Without this option, \fBtestparm\fP will prompt for a +carriage return after printing the service names and before dumping +the service definitions\&. +.IP .IP "\fBconfigfilename\fP" This is the name of the configuration file to check\&. If this parameter is not present then the default diff --git a/docs/yodldocs/testparm.1.yo b/docs/yodldocs/testparm.1.yo index ebb6120746..1c463a5ee4 100644 --- a/docs/yodldocs/testparm.1.yo +++ b/docs/yodldocs/testparm.1.yo @@ -8,7 +8,7 @@ manpagename(testparm)(check an smb.conf configuration file for internal correctn label(SYNOPSIS) manpagesynopsis() -bf(testparm) [link(configfilename)(configfilename) [link(hostname)(hostname) link(hostIP)(hostIP)] ] +bf(testparm) [link(-s)(minuss)] [link(configfilename)(configfilename)] [link(hostname)(hostname) link(hostIP)(hostIP)] label(DESCRIPTION) manpagedescription() @@ -33,6 +33,11 @@ manpageoptions() startdit() +label(minuss) +dit(bf(-s)) Without this option, bf(testparm) will prompt for a +carriage return after printing the service names and before dumping +the service definitions. + label(configfilename) dit(bf(configfilename)) This is the name of the configuration file to check. If this parameter is not present then the default 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)) |