1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-09 08:58:35 +03:00

update testparm with -s option so it doesn't require a carriage return

also allow specifying [host hostip] without [configfile]
updated man page
This commit is contained in:
Herb Lewis -
parent 5ad77769be
commit 85fbd40102
4 changed files with 51 additions and 13 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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))