<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>
<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
.PP
.SH "SYNOPSIS"
.PP
-\fBtestparm\fP [configfilename [hostname hostIP] ]
+\fBtestparm\fP [-s] [configfilename] [hostname hostIP]
.PP
.SH "DESCRIPTION"
.PP
.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
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()
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
int main(int argc, char *argv[])
{
+ extern char *optarg;
+ extern int optind;
pstring configfile;
+ int opt;
int s;
+ BOOL silent_mode = False;
TimeInit();
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;
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))