summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJim McDonough <jmcd@samba.org>2002-03-15 20:03:07 +0000
committerJim McDonough <jmcd@samba.org>2002-03-15 20:03:07 +0000
commitbb38f48f6f2b5a5b8803c622e40107bb15876625 (patch)
tree59f3205bfa0faefc16310ace56d663f4feaadbfe /source3
parent7d4378cc892550465b75aae563cd6f7ea1608c21 (diff)
downloadsamba-bb38f48f6f2b5a5b8803c622e40107bb15876625.tar.gz
samba-bb38f48f6f2b5a5b8803c622e40107bb15876625.tar.bz2
samba-bb38f48f6f2b5a5b8803c622e40107bb15876625.zip
Some help cleanups. Formatting and consistency issues. Line up text nicely, and make 'net help rap user' the same as 'net rap user help'...stuff like that
(This used to be commit 17775dae28c724b11cc73f2aeac5f07f9656046c)
Diffstat (limited to 'source3')
-rw-r--r--source3/utils/net.c72
-rw-r--r--source3/utils/net_lookup.c2
-rw-r--r--source3/utils/net_rap.c70
-rw-r--r--source3/utils/net_rpc.c44
-rw-r--r--source3/utils/net_time.c3
5 files changed, 108 insertions, 83 deletions
diff --git a/source3/utils/net.c b/source3/utils/net.c
index aac5235ac8..a8ef721512 100644
--- a/source3/utils/net.c
+++ b/source3/utils/net.c
@@ -79,6 +79,27 @@ struct in_addr opt_dest_ip;
extern pstring global_myname;
+int net_common_flags_usage(int argc, const char **argv)
+{
+
+ d_printf("Valid targets: choose one (none defaults to localhost)\n");
+ d_printf("\t-S or --server=<server>\t\tserver name\n");
+ d_printf("\t-I or --ipaddress=<ipaddr>\taddress of target server\n");
+ d_printf("\t-w or --workgroup=<wg>\t\ttarget workgroup or domain\n");
+
+ d_printf("\n");
+ d_printf("Valid miscellaneous options are:\n"); /* misc options */
+ d_printf("\t-p or --port=<port>\tconnection port on target server\n");
+ d_printf("\t-W or --myworkgroup=<wg>\tclient workgroup\n");
+ d_printf("\t-d or --debug=<level>\t\tdebug level (0-10)\n");
+ d_printf("\t-n or --myname=<name>\t\tclient name\n");
+ d_printf("\t-U or --user=<name>\t\tuser name\n");
+ d_printf("\t-s or --conf=<path>\t\tpathname of smb.conf file\n");
+ d_printf("\t-l or --long\t\t\tDisplay full information\n");
+ return -1;
+}
+
+
/*
run a function from a function table. If not found then
call the specified usage function
@@ -283,11 +304,14 @@ struct cli_state *net_make_ipc_connection(unsigned flags)
static int net_usage(int argc, const char **argv)
{
- d_printf(" net ads [command]\tto run ADS commands\n"\
+ d_printf(" net time\t\t to view or set time information\n"\
+ " net lookup\t\t to lookup host name or ip address\n"\
+ "\n"\
+ " net ads [command]\tto run ADS commands\n"\
" net rap [command]\tto run RAP (pre-RPC) commands\n"\
" net rpc [command]\tto run RPC commands\n"\
- " net rap help\n"\
- "\nType \"net help <option>\" to get more information on that option\n");
+ "\n"\
+ "Type \"net help <option>\" to get more information on that option\n");
return -1;
}
@@ -310,7 +334,7 @@ static int net_help(int argc, const char **argv)
{
struct functable func[] = {
{"ADS", net_ads_usage},
- {"RAP", net_rap_usage},
+ {"RAP", net_rap_help},
{"RPC", net_rpc_usage},
{"FILE", net_rap_file_usage},
@@ -332,7 +356,7 @@ static int net_help(int argc, const char **argv)
{"HELP", help_usage},
{NULL, NULL}};
- return net_run_function(argc, argv, func, help_usage);
+ return net_run_function(argc, argv, func, net_usage);
}
/* main function table */
@@ -378,25 +402,25 @@ static struct functable net_func[] = {
static int debuglevel;
struct poptOption long_options[] = {
- {"help", 'h', POPT_ARG_NONE, 0, 'h'},
- {"workgroup", 'w', POPT_ARG_STRING, &opt_target_workgroup},
- {"myworkgroup", 'W', POPT_ARG_STRING, &opt_workgroup},
- {"user", 'U', POPT_ARG_STRING, &opt_user_name, 'U'},
- {"ipaddress", 'I', POPT_ARG_STRING, 0, 'I'},
- {"port", 'p', POPT_ARG_INT, &opt_port},
- {"myname", 'n', POPT_ARG_STRING, &opt_requester_name},
- {"conf", 's', POPT_ARG_STRING, &servicesf},
- {"debug", 'd', POPT_ARG_INT, &debuglevel, 'd'},
- {"debuglevel", 'd', POPT_ARG_INT, &debuglevel, 'd'},
- {"server", 'S', POPT_ARG_STRING, &opt_host},
- {"comment", 'C', POPT_ARG_STRING, &opt_comment},
- {"maxusers", 'M', POPT_ARG_INT, &opt_maxusers},
- {"flags", 'F', POPT_ARG_INT, &opt_flags},
- {"jobid", 'j', POPT_ARG_INT, &opt_jobid},
- {"long", 'l', POPT_ARG_NONE, &opt_long_list_entries},
- {"reboot", 'r', POPT_ARG_NONE, &opt_reboot},
- {"force", 'f', POPT_ARG_NONE, &opt_force},
- {"timeout", 't', POPT_ARG_INT, &opt_timeout},
+ {"help", 'h', POPT_ARG_NONE, 0, 'h'},
+ {"workgroup", 'w', POPT_ARG_STRING, &opt_target_workgroup},
+ {"myworkgroup", 'W', POPT_ARG_STRING, &opt_workgroup},
+ {"user", 'U', POPT_ARG_STRING, &opt_user_name, 'U'},
+ {"ipaddress", 'I', POPT_ARG_STRING, 0,'I'},
+ {"port", 'p', POPT_ARG_INT, &opt_port},
+ {"myname", 'n', POPT_ARG_STRING, &opt_requester_name},
+ {"conf", 's', POPT_ARG_STRING, &servicesf},
+ {"debug", 'd', POPT_ARG_INT, &debuglevel, 'd'},
+ {"debuglevel", 'd', POPT_ARG_INT, &debuglevel, 'd'},
+ {"server", 'S', POPT_ARG_STRING, &opt_host},
+ {"comment", 'C', POPT_ARG_STRING, &opt_comment},
+ {"maxusers", 'M', POPT_ARG_INT, &opt_maxusers},
+ {"flags", 'F', POPT_ARG_INT, &opt_flags},
+ {"jobid", 'j', POPT_ARG_INT, &opt_jobid},
+ {"long", 'l', POPT_ARG_NONE, &opt_long_list_entries},
+ {"reboot", 'r', POPT_ARG_NONE, &opt_reboot},
+ {"force", 'f', POPT_ARG_NONE, &opt_force},
+ {"timeout", 't', POPT_ARG_INT, &opt_timeout},
{ 0, 0, 0, 0}
};
diff --git a/source3/utils/net_lookup.c b/source3/utils/net_lookup.c
index fd8b9d24ef..0cc1ff579f 100644
--- a/source3/utils/net_lookup.c
+++ b/source3/utils/net_lookup.c
@@ -23,7 +23,7 @@
int net_lookup_usage(int argc, const char **argv)
{
d_printf(
-"net lookup host HOSTNAME <type>\n\tgives IP for a hostname\n\n"\
+" net lookup host HOSTNAME <type>\n\tgives IP for a hostname\n\n"\
"\n");
return -1;
}
diff --git a/source3/utils/net_rap.c b/source3/utils/net_rap.c
index f6d05522d4..d1cc8271f7 100644
--- a/source3/utils/net_rap.c
+++ b/source3/utils/net_rap.c
@@ -48,27 +48,6 @@ static int errmsg_not_implemented(void)
return 0;
}
-int general_rap_usage(int argc, const char **argv)
-{
-
- d_printf("Valid targets: choose one (none defaults to localhost)\n");
- d_printf("\t-S or --server=<server>\t\tserver name\n");
- d_printf("\t-I or --ipaddress=<ipaddr>\taddress of target server\n");
- d_printf("\t-w or --workgroup=<wg>\t\ttarget workgroup or domain\n");
-
- d_printf("\n");
- d_printf("Valid miscellaneous options are:\n"); /* misc options */
- d_printf("\t-p or --port=<port>\tconnection port on target server\n");
- d_printf("\t-W or --myworkgroup=<wg>\tclient workgroup\n");
- d_printf("\t-d or --debug=<level>\t\tdebug level (0-10)\n");
- d_printf("\t-n or --myname=<name>\t\tclient name\n");
- d_printf("\t-U or --user=<name>\t\tuser name\n");
- d_printf("\t-s or --conf=<path>\t\tpathname of smb.conf file\n");
- d_printf("\t-l or --long\t\t\tDisplay full information\n");
- return -1;
-}
-
-
int net_rap_file_usage(int argc, const char **argv)
{
d_printf("net rap file [misc. options] [targets]\n"\
@@ -78,7 +57,7 @@ int net_rap_file_usage(int argc, const char **argv)
d_printf("net rap file CLOSE <id> [misc. options] [targets]\n"\
"\tcloses specified file on target server\n");
- general_rap_usage(argc, argv);
+ net_common_flags_usage(argc, argv);
return -1;
}
@@ -188,7 +167,7 @@ int net_rap_share_usage(int argc, const char **argv)
"\tor"\
"\nnet rap share CLOSE <sharename> [misc. options] [targets]"\
"\n\tDeletes a share from a server (makes the export inactive)\n");
- general_rap_usage(argc, argv);
+ net_common_flags_usage(argc, argv);
d_printf(
"\t-C or --comment=<comment>\tdescriptive comment (for add only)\n");
d_printf("\t-M or --maxusers=<num>\t\tmax users allowed for share\n");
@@ -306,7 +285,7 @@ int net_rap_session_usage(int argc, const char **argv)
"\nnet rap session CLOSE <client_name> [misc. options] [targets]"\
"\n\tDeletes (closes) a session from specified client to server\n");
- general_rap_usage(argc, argv);
+ net_common_flags_usage(argc, argv);
return -1;
}
@@ -441,7 +420,7 @@ int net_rap_server_usage(int argc, const char **argv)
d_printf("\n\tIf domain is not specified, it uses the current"\
" domain or workgroup as\n\tthe default.\n");
- general_rap_usage(argc, argv);
+ net_common_flags_usage(argc, argv);
return -1;
}
@@ -468,7 +447,7 @@ int net_rap_domain_usage(int argc, const char **argv)
d_printf("net rap domain [misc. options] [target]\n\tlists the"\
" domains or workgroups visible on the current network\n");
- general_rap_usage(argc, argv);
+ net_common_flags_usage(argc, argv);
return -1;
}
@@ -504,7 +483,7 @@ int net_rap_printq_usage(int argc, const char **argv)
"\tdeletes the specified job number on the target server, or the\n"\
"\tprinter queue if no job number is specified\n");
- general_rap_usage(argc, argv);
+ net_common_flags_usage(argc, argv);
d_printf("\t-j or --jobid=<job id>\t\tjob id\n");
return -1;
@@ -636,7 +615,7 @@ int net_rap_user_usage(int argc, const char **argv)
d_printf("\nnet rap user ADD <name> [-F user flags] [misc. options]"\
" [targets]\n\tAdd specified user\n");
- general_rap_usage(argc, argv);
+ net_common_flags_usage(argc, argv);
d_printf(
"\t-C or --comment=<comment>\tdescriptive comment (for add only)\n");
return -1;
@@ -770,7 +749,7 @@ int net_rap_group_usage(int argc, const char **argv)
d_printf("\nnet rap group ADD <name> [-C comment] [misc. options]"\
" [targets]\n\tCreate specified group\n");
- general_rap_usage(argc, argv);
+ net_common_flags_usage(argc, argv);
d_printf(
"\t-C or --comment=<comment>\tdescriptive comment (for add only)\n");
return -1;
@@ -866,7 +845,7 @@ int net_rap_groupmember_usage(int argc, const char **argv)
"\nnet rap groupmember ADD <group> <user> [misc. options] [targets]"\
"\n\t Add specified user to specified group\n");
- general_rap_usage(argc, argv);
+ net_common_flags_usage(argc, argv);
return -1;
}
@@ -940,7 +919,7 @@ int net_rap_validate_usage(int argc, const char **argv)
"\tValidate user and password to check whether they"\
" can access target server or domain\n");
- general_rap_usage(argc, argv);
+ net_common_flags_usage(argc, argv);
return -1;
}
@@ -959,7 +938,7 @@ int net_rap_service_usage(int argc, const char **argv)
d_printf("\nnet rap service STOP <name> [misc. options] [targets]\n"\
"\n\tStop named service on remote server\n");
- general_rap_usage(argc, argv);
+ net_common_flags_usage(argc, argv);
return -1;
}
@@ -1047,38 +1026,27 @@ int net_rap_admin(int argc, const char **argv)
int net_rap_usage(int argc, const char **argv)
{
d_printf(" net rap domain \tto list domains \n"\
- " net rap file \tto list open files on a server \n"\
+ " net rap file \t\tto list open files on a server \n"\
" net rap group \tto list user groups \n"\
- " net rap groupmember to list users in a group \n"\
- " net rap password\t to change the password of a user\n"\
+ " net rap groupmember \tto list users in a group \n"\
+ " net rap password \tto change the password of a user\n"\
" net rap printq \tto list the print queues on a server\n"\
" net rap server \tto list servers in a domain\n"\
" net rap session \tto list clients with open sessions to a server\n"\
" net rap share \tto list shares exported by a server\n"\
- " net rap user \tto list users\n"\
+ " net rap user \t\tto list users\n"\
" net rap validate \tto check whether a user and the corresponding password are valid\n"\
" net rap help\n"\
"\nType \"net help <option>\" to get more information on that option\n\n");
- general_rap_usage(argc, argv);
- return -1;
-}
-
-int rap_help_usage(int argc, const char **argv)
-{
- d_printf("\n"\
- "Usage: net rap help <function>\n"\
- "\n"\
- "Valid functions are:\n"\
- " FILE SHARE SESSION SERVER DOMAIN PRINTQ USER GROUP\n"\
- " VALIDATE GROUPMEMBER ADMIN SERVICE PASSWORD\n");
+ net_common_flags_usage(argc, argv);
return -1;
}
/*
- handle "net help rap *" subcommands
+ handle "net rap help *" subcommands
*/
-static int net_rap_help(int argc, const char **argv)
+int net_rap_help(int argc, const char **argv)
{
struct functable func[] = {
{"FILE", net_rap_file_usage},
@@ -1096,7 +1064,7 @@ static int net_rap_help(int argc, const char **argv)
{"PASSWORD", net_rap_password_usage},
{NULL, NULL}};
- return net_run_function(argc, argv, func, rap_help_usage);
+ return net_run_function(argc, argv, func, net_rap_usage);
}
/* Entry-point for all the RAP functions. */
diff --git a/source3/utils/net_rpc.c b/source3/utils/net_rpc.c
index 42cfd4c647..2ea3142dd5 100644
--- a/source3/utils/net_rpc.c
+++ b/source3/utils/net_rpc.c
@@ -915,6 +915,7 @@ static int rpc_trustdom(int argc, const char **argv)
{"del", rpc_trustdom_del},
{"establish", rpc_trustdom_establish},
{"revoke", rpc_trustdom_revoke},
+ {"help", rpc_trustdom_usage},
{NULL, NULL}
};
@@ -932,18 +933,18 @@ static int rpc_trustdom(int argc, const char **argv)
/**
* Basic usage function for 'net rpc'
* @param argc Standard main() style argc
- * @param argc Standard main() style argv. Initial components are already
+ * @param argv Standard main() style argv. Initial components are already
* stripped
**/
int net_rpc_usage(int argc, const char **argv)
{
- d_printf(" net rpc join \tto join a domain \n");
- d_printf(" net rpc user \tto add, delete and list users\n");
+ d_printf(" net rpc join \t\t\tto join a domain \n");
+ d_printf(" net rpc user \t\t\tto add, delete and list users\n");
d_printf(" net rpc changetrustpw \tto change the trust account password\n");
- d_printf(" net rpc trustdom \tto create trusting domain's account or establish trust\n");
+ d_printf(" net rpc trustdom \t\tto create trusting domain's account or establish trust\n");
d_printf(" net rpc abortshutdown \tto to abort the shutdown of a remote server\n");
- d_printf(" net rpc shutdown \tto to shutdown a remote server\n");
+ d_printf(" net rpc shutdown \t\tto to shutdown a remote server\n");
d_printf("\n");
d_printf("'net rpc shutdown' also accepts the following miscellaneous options:\n"); /* misc options */
d_printf("\t-r or --reboot\trequest remote server reboot on shutdown\n");
@@ -953,10 +954,40 @@ int net_rpc_usage(int argc, const char **argv)
return -1;
}
+
+/**
+ * Help function for 'net rpc'. Calls command specific help if requested
+ * or displays usage of net rpc
+ * @param argc Standard main() style argc
+ * @param argv Standard main() style argv. Initial components are already
+ * stripped
+ **/
+
+int rpc_help(int argc, const char **argv)
+{
+ struct functable func[] = {
+ {"join", rpc_join_usage},
+ {"user", rpc_user_usage},
+ //{"changetrustpw", rpc_changetrustpw_usage},
+ {"trustdom", rpc_trustdom_usage},
+ //{"abortshutdown", rpc_shutdown_abort_usage},
+ //{"shutdown", rpc_shutdown_usage},
+ {NULL, NULL}
+ };
+
+ if (argc == 0) {
+ net_rpc_usage(argc, argv);
+ return -1;
+ }
+
+ return (net_run_function(argc, argv, func, rpc_user_usage));
+}
+
+
/**
* 'net rpc' entrypoint.
* @param argc Standard main() style argc
- * @param argc Standard main() style argv. Initial components are already
+ * @param argv Standard main() style argv. Initial components are already
* stripped
**/
@@ -969,6 +1000,7 @@ int net_rpc(int argc, const char **argv)
{"trustdom", rpc_trustdom},
{"abortshutdown", rpc_shutdown_abort},
{"shutdown", rpc_shutdown},
+ {"help", rpc_help},
{NULL, NULL}
};
return net_run_function(argc, argv, func, net_rpc_usage);
diff --git a/source3/utils/net_time.c b/source3/utils/net_time.c
index a3a230e0da..3f5532109c 100644
--- a/source3/utils/net_time.c
+++ b/source3/utils/net_time.c
@@ -94,7 +94,7 @@ int net_time_usage(int argc, const char **argv)
"net time set\n\truns /bin/date with the time from the server\n\n"\
"net time zone\n\tdisplays the timezone in hours from GMT on the remote computer\n\n"\
"\n");
- general_rap_usage(argc, argv);
+ net_common_flags_usage(argc, argv);
return -1;
}
@@ -168,6 +168,7 @@ int net_time(int argc, const char **argv)
if (!opt_host && !opt_have_ip) {
d_printf("You must specify a hostname or IP\n");
+ net_time_usage(argc,argv);
return -1;
}