diff options
author | Kai Blin <kai@samba.org> | 2008-06-07 02:25:08 +0200 |
---|---|---|
committer | Kai Blin <kai@samba.org> | 2008-06-10 09:48:21 +0200 |
commit | 255bdb26025a5025bc60637dd924f6ec71c49ee5 (patch) | |
tree | 4e2301ae2fb17a37c45b2f9d87c685ea764c74de /source3/utils | |
parent | cd06703a3f382bd114ae7634cdd7c630947cf785 (diff) | |
download | samba-255bdb26025a5025bc60637dd924f6ec71c49ee5.tar.gz samba-255bdb26025a5025bc60637dd924f6ec71c49ee5.tar.bz2 samba-255bdb26025a5025bc60637dd924f6ec71c49ee5.zip |
net: Rename functable3 to functable, get rid of old functables
(This used to be commit bb7c5fc4ec77db4073d3beccf12af12910b6bd07)
Diffstat (limited to 'source3/utils')
-rw-r--r-- | source3/utils/net.c | 4 | ||||
-rw-r--r-- | source3/utils/net.h | 11 | ||||
-rw-r--r-- | source3/utils/net_ads.c | 28 | ||||
-rw-r--r-- | source3/utils/net_ads_gpo.c | 4 | ||||
-rw-r--r-- | source3/utils/net_afs.c | 4 | ||||
-rw-r--r-- | source3/utils/net_cache.c | 4 | ||||
-rw-r--r-- | source3/utils/net_conf.c | 2 | ||||
-rw-r--r-- | source3/utils/net_dom.c | 4 | ||||
-rw-r--r-- | source3/utils/net_groupmap.c | 4 | ||||
-rw-r--r-- | source3/utils/net_help.c | 6 | ||||
-rw-r--r-- | source3/utils/net_idmap.c | 4 | ||||
-rw-r--r-- | source3/utils/net_proto.h | 10 | ||||
-rw-r--r-- | source3/utils/net_rap.c | 40 | ||||
-rw-r--r-- | source3/utils/net_registry.c | 4 | ||||
-rw-r--r-- | source3/utils/net_rpc.c | 40 | ||||
-rw-r--r-- | source3/utils/net_rpc_audit.c | 4 | ||||
-rw-r--r-- | source3/utils/net_rpc_registry.c | 4 | ||||
-rw-r--r-- | source3/utils/net_rpc_rights.c | 4 | ||||
-rw-r--r-- | source3/utils/net_rpc_service.c | 4 | ||||
-rw-r--r-- | source3/utils/net_sam.c | 20 | ||||
-rw-r--r-- | source3/utils/net_status.c | 4 | ||||
-rw-r--r-- | source3/utils/net_time.c | 4 | ||||
-rw-r--r-- | source3/utils/net_usershare.c | 4 | ||||
-rw-r--r-- | source3/utils/net_util.c | 53 |
24 files changed, 102 insertions, 168 deletions
diff --git a/source3/utils/net.c b/source3/utils/net.c index b1401e97ba..c298fdb461 100644 --- a/source3/utils/net.c +++ b/source3/utils/net.c @@ -313,7 +313,7 @@ static int net_maxrid(struct net_context *c, int argc, const char **argv) } /* main function table */ -static struct functable3 net_func[] = { +static struct functable net_func[] = { { "rpc", net_rpc, @@ -759,7 +759,7 @@ static struct functable3 net_func[] = { } c->private_data = net_func; - rc = net_run_function3(c, argc_new-1, argv_new+1, "net", net_func); + rc = net_run_function(c, argc_new-1, argv_new+1, "net", net_func); DEBUG(2,("return code = %d\n", rc)); diff --git a/source3/utils/net.h b/source3/utils/net.h index d1e759c5a9..ef5cfa73de 100644 --- a/source3/utils/net.h +++ b/source3/utils/net.h @@ -74,17 +74,6 @@ struct net_context { struct functable { const char *funcname; int (*fn)(struct net_context *c, int argc, const char **argv); -}; - -struct functable2 { - const char *funcname; - int (*fn)(struct net_context *c, int argc, const char **argv); - const char *helptext; -}; - -struct functable3 { - const char *funcname; - int (*fn)(struct net_context *c, int argc, const char **argv); int valid_transports; const char *description; const char *usage; diff --git a/source3/utils/net_ads.c b/source3/utils/net_ads.c index a71ba5b1d2..f945bfaafb 100644 --- a/source3/utils/net_ads.c +++ b/source3/utils/net_ads.c @@ -603,7 +603,7 @@ static int ads_user_delete(struct net_context *c, int argc, const char **argv) int net_ads_user(struct net_context *c, int argc, const char **argv) { - struct functable3 func[] = { + struct functable func[] = { { "add", ads_user_add, @@ -663,7 +663,7 @@ int net_ads_user(struct net_context *c, int argc, const char **argv) return ADS_ERR_OK(rc) ? 0 : -1; } - return net_run_function3(c, argc, argv, "net ads user", func); + return net_run_function(c, argc, argv, "net ads user", func); } static int net_ads_group_usage(struct net_context *c, int argc, const char **argv) @@ -762,7 +762,7 @@ static int ads_group_delete(struct net_context *c, int argc, const char **argv) int net_ads_group(struct net_context *c, int argc, const char **argv) { - struct functable3 func[] = { + struct functable func[] = { { "add", ads_group_add, @@ -813,7 +813,7 @@ int net_ads_group(struct net_context *c, int argc, const char **argv) ads_destroy(&ads); return ADS_ERR_OK(rc) ? 0 : -1; } - return net_run_function3(c, argc, argv, "net ads group", func); + return net_run_function(c, argc, argv, "net ads group", func); } static int net_ads_status(struct net_context *c, int argc, const char **argv) @@ -1405,7 +1405,7 @@ static int net_ads_dns_gethostbyname(struct net_context *c, int argc, const char static int net_ads_dns(struct net_context *c, int argc, const char *argv[]) { - struct functable3 func[] = { + struct functable func[] = { { "register", net_ads_dns_register, @@ -1425,7 +1425,7 @@ static int net_ads_dns(struct net_context *c, int argc, const char *argv[]) {NULL, NULL, 0, NULL, NULL} }; - return net_run_function3(c, argc, argv, "net ads dns", func); + return net_run_function(c, argc, argv, "net ads dns", func); } /******************************************************************* @@ -1730,7 +1730,7 @@ static int net_ads_printer_remove(struct net_context *c, int argc, const char ** static int net_ads_printer(struct net_context *c, int argc, const char **argv) { - struct functable3 func[] = { + struct functable func[] = { { "search", net_ads_printer_search, @@ -1766,7 +1766,7 @@ static int net_ads_printer(struct net_context *c, int argc, const char **argv) {NULL, NULL, 0, NULL, NULL} }; - return net_run_function3(c, argc, argv, "net ads printer", func); + return net_run_function(c, argc, argv, "net ads printer", func); } @@ -2178,7 +2178,7 @@ static int net_ads_keytab_list(struct net_context *c, int argc, const char **arg int net_ads_keytab(struct net_context *c, int argc, const char **argv) { - struct functable3 func[] = { + struct functable func[] = { { "add", net_ads_keytab_add, @@ -2219,7 +2219,7 @@ int net_ads_keytab(struct net_context *c, int argc, const char **argv) use keytab functions.\n"); } - return net_run_function3(c, argc, argv, "net ads keytab", func); + return net_run_function(c, argc, argv, "net ads keytab", func); } static int net_ads_kerberos_renew(struct net_context *c, int argc, const char **argv) @@ -2333,7 +2333,7 @@ static int net_ads_kerberos_kinit(struct net_context *c, int argc, const char ** int net_ads_kerberos(struct net_context *c, int argc, const char **argv) { - struct functable3 func[] = { + struct functable func[] = { { "kinit", net_ads_kerberos_kinit, @@ -2361,12 +2361,12 @@ int net_ads_kerberos(struct net_context *c, int argc, const char **argv) {NULL, NULL, 0, NULL, NULL} }; - return net_run_function3(c, argc, argv, "net ads kerberos", func); + return net_run_function(c, argc, argv, "net ads kerberos", func); } int net_ads(struct net_context *c, int argc, const char **argv) { - struct functable3 func[] = { + struct functable func[] = { { "info", net_ads_info, @@ -2522,7 +2522,7 @@ int net_ads(struct net_context *c, int argc, const char **argv) {NULL, NULL, 0, NULL, NULL} }; - return net_run_function3(c, argc, argv, "net ads", func); + return net_run_function(c, argc, argv, "net ads", func); } #else diff --git a/source3/utils/net_ads_gpo.c b/source3/utils/net_ads_gpo.c index 4eb0b444a1..3c66325abe 100644 --- a/source3/utils/net_ads_gpo.c +++ b/source3/utils/net_ads_gpo.c @@ -615,7 +615,7 @@ out: int net_ads_gpo(struct net_context *c, int argc, const char **argv) { - struct functable3 func[] = { + struct functable func[] = { #if 0 { "apply", @@ -689,7 +689,7 @@ int net_ads_gpo(struct net_context *c, int argc, const char **argv) {NULL, NULL, 0, NULL, NULL} }; - return net_run_function3(c, argc, argv, "net ads gpo", func); + return net_run_function(c, argc, argv, "net ads gpo", func); } #endif /* HAVE_ADS */ diff --git a/source3/utils/net_afs.c b/source3/utils/net_afs.c index cdc029e2df..0f19ec1e12 100644 --- a/source3/utils/net_afs.c +++ b/source3/utils/net_afs.c @@ -90,7 +90,7 @@ int net_afs_impersonate(struct net_context *c, int argc, int net_afs(struct net_context *c, int argc, const char **argv) { - struct functable3 func[] = { + struct functable func[] = { { "key", net_afs_key, @@ -109,6 +109,6 @@ int net_afs(struct net_context *c, int argc, const char **argv) }, {NULL, NULL, 0, NULL, NULL} }; - return net_run_function3(c, argc, argv, "net afs", func); + return net_run_function(c, argc, argv, "net afs", func); } diff --git a/source3/utils/net_cache.c b/source3/utils/net_cache.c index 7c5acbc23d..4e9ae18c0d 100644 --- a/source3/utils/net_cache.c +++ b/source3/utils/net_cache.c @@ -310,7 +310,7 @@ static int net_cache_flush(struct net_context *c, int argc, const char **argv) **/ int net_cache(struct net_context *c, int argc, const char **argv) { - struct functable3 func[] = { + struct functable func[] = { { "add", net_cache_add, @@ -369,5 +369,5 @@ int net_cache(struct net_context *c, int argc, const char **argv) {NULL, NULL, 0, NULL, NULL} }; - return net_run_function3(c, argc, argv, "net cache", func); + return net_run_function(c, argc, argv, "net cache", func); } diff --git a/source3/utils/net_conf.c b/source3/utils/net_conf.c index f63f04e09a..ab1b0f3df7 100644 --- a/source3/utils/net_conf.c +++ b/source3/utils/net_conf.c @@ -1024,7 +1024,7 @@ struct conf_functable { }; /** - * This imitates net_run_function3 but calls the main functions + * This imitates net_run_function but calls the main functions * through the wrapper net_conf_wrap_function(). */ static int net_conf_run_function(struct net_context *c, int argc, diff --git a/source3/utils/net_dom.c b/source3/utils/net_dom.c index 2f18d07785..9f6581027f 100644 --- a/source3/utils/net_dom.c +++ b/source3/utils/net_dom.c @@ -227,7 +227,7 @@ int net_dom(struct net_context *c, int argc, const char **argv) { NET_API_STATUS status; - struct functable3 func[] = { + struct functable func[] = { { "join", net_dom_join, @@ -257,5 +257,5 @@ int net_dom(struct net_context *c, int argc, const char **argv) libnetapi_set_username(c->netapi_ctx, c->opt_user_name); libnetapi_set_password(c->netapi_ctx, c->opt_password); - return net_run_function3(c, argc, argv, "net dom", func); + return net_run_function(c, argc, argv, "net dom", func); } diff --git a/source3/utils/net_groupmap.c b/source3/utils/net_groupmap.c index cea1b0a3d7..b160d840a0 100644 --- a/source3/utils/net_groupmap.c +++ b/source3/utils/net_groupmap.c @@ -811,7 +811,7 @@ static int net_groupmap_memberships(struct net_context *c, int argc, const char **********************************************************/ int net_groupmap(struct net_context *c, int argc, const char **argv) { - struct functable3 func[] = { + struct functable func[] = { { "add", net_groupmap_add, @@ -901,6 +901,6 @@ int net_groupmap(struct net_context *c, int argc, const char **argv) return -1; } - return net_run_function3(c,argc, argv, "net groupmap", func); + return net_run_function(c,argc, argv, "net groupmap", func); } diff --git a/source3/utils/net_help.c b/source3/utils/net_help.c index 035914431e..0502373aa2 100644 --- a/source3/utils/net_help.c +++ b/source3/utils/net_help.c @@ -30,7 +30,7 @@ static int net_help_usage(struct net_context *c, int argc, const char **argv) static int net_usage(struct net_context *c, int argc, const char **argv) { - struct functable3 *table = (struct functable3*) c->private_data; + struct functable *table = (struct functable*) c->private_data; int i; d_printf("Usage:\n"); @@ -54,7 +54,7 @@ static int net_usage(struct net_context *c, int argc, const char **argv) */ int net_help(struct net_context *c, int argc, const char **argv) { - struct functable3 *func = (struct functable3 *)c->private_data; + struct functable *func = (struct functable *)c->private_data; if (argc == 0) { return net_usage(c, argc, argv); @@ -65,5 +65,5 @@ int net_help(struct net_context *c, int argc, const char **argv) } c->display_usage = true; - return net_run_function3(c, argc, argv, "net help", func); + return net_run_function(c, argc, argv, "net help", func); } diff --git a/source3/utils/net_idmap.c b/source3/utils/net_idmap.c index 9fab29c9a5..bd363922f6 100644 --- a/source3/utils/net_idmap.c +++ b/source3/utils/net_idmap.c @@ -383,7 +383,7 @@ fail: **********************************************************/ int net_idmap(struct net_context *c, int argc, const char **argv) { - struct functable3 func[] = { + struct functable func[] = { { "dump", net_idmap_dump, @@ -435,7 +435,7 @@ int net_idmap(struct net_context *c, int argc, const char **argv) {NULL, NULL, 0, NULL, NULL} }; - return net_run_function3(c, argc, argv, "net idmap", func); + return net_run_function(c, argc, argv, "net idmap", func); } diff --git a/source3/utils/net_proto.h b/source3/utils/net_proto.h index 0c702bbf91..fe3b8648db 100644 --- a/source3/utils/net_proto.h +++ b/source3/utils/net_proto.h @@ -449,14 +449,8 @@ NTSTATUS net_make_ipc_connection_ex(struct net_context *c ,const char *domain, unsigned flags, struct cli_state **pcli); const char *net_prompt_pass(struct net_context *c, const char *user); int net_run_function(struct net_context *c, int argc, const char **argv, - struct functable *table, - int (*usage_fn)(struct net_context *c, - int argc, const char **argv)); -int net_run_function2(struct net_context *c, int argc, const char **argv, - const char *whoami, struct functable2 *table); -int net_run_function3(struct net_context *c, int argc, const char **argv, - const char *whoami, struct functable3 *table); -void net_display_usage_from_functable(struct functable3 *table); + const char *whoami, struct functable *table); +void net_display_usage_from_functable(struct functable *table); /* The following definitions come from utils/netlookup.c */ diff --git a/source3/utils/net_rap.c b/source3/utils/net_rap.c index eeb1234e5f..52c4ccffa7 100644 --- a/source3/utils/net_rap.c +++ b/source3/utils/net_rap.c @@ -132,7 +132,7 @@ static int rap_file_user(struct net_context *c, int argc, const char **argv) int net_rap_file(struct net_context *c, int argc, const char **argv) { - struct functable3 func[] = { + struct functable func[] = { { "close", rap_file_close, @@ -189,7 +189,7 @@ int net_rap_file(struct net_context *c, int argc, const char **argv) return ret; } - return net_run_function3(c, argc, argv, "net rap file", func); + return net_run_function(c, argc, argv, "net rap file", func); } int net_rap_share_usage(struct net_context *c, int argc, const char **argv) @@ -271,7 +271,7 @@ static int rap_share_add(struct net_context *c, int argc, const char **argv) int net_rap_share(struct net_context *c, int argc, const char **argv) { - struct functable3 func[] = { + struct functable func[] = { { "delete", rap_share_delete, @@ -328,7 +328,7 @@ int net_rap_share(struct net_context *c, int argc, const char **argv) return ret; } - return net_run_function3(c, argc, argv, "net rap share", func); + return net_run_function(c, argc, argv, "net rap share", func); } int net_rap_session_usage(struct net_context *c, int argc, const char **argv) @@ -436,7 +436,7 @@ static int rap_session_delete(struct net_context *c, int argc, const char **argv int net_rap_session(struct net_context *c, int argc, const char **argv) { - struct functable3 func[] = { + struct functable func[] = { { "info", rap_session_info, @@ -490,7 +490,7 @@ int net_rap_session(struct net_context *c, int argc, const char **argv) return ret; } - return net_run_function3(c, argc, argv, "net rap session", func); + return net_run_function(c, argc, argv, "net rap session", func); } /**************************************************************************** @@ -558,7 +558,7 @@ static int net_rap_server_domain(struct net_context *c, int argc, int net_rap_server(struct net_context *c, int argc, const char **argv) { - struct functable3 func[] = { + struct functable func[] = { { "name", net_rap_server_name, @@ -580,7 +580,7 @@ int net_rap_server(struct net_context *c, int argc, const char **argv) /* smb4k uses 'net [rap|rpc] server domain' to query servers in a domain */ /* Fall through for 'domain', any other forms will cause to show usage message */ - return net_run_function3(c, argc, argv, "net rap server", func); + return net_run_function(c, argc, argv, "net rap server", func); } @@ -728,7 +728,7 @@ int net_rap_printq(struct net_context *c, int argc, const char **argv) struct cli_state *cli; int ret; - struct functable3 func[] = { + struct functable func[] = { { "info", rap_printq_info, @@ -766,7 +766,7 @@ int net_rap_printq(struct net_context *c, int argc, const char **argv) return ret; } - return net_run_function3(c, argc, argv, "net rap printq", func); + return net_run_function(c, argc, argv, "net rap printq", func); } static int net_rap_user_usage(struct net_context *c, int argc, const char **argv) @@ -858,7 +858,7 @@ static int rap_user_info(struct net_context *c, int argc, const char **argv) int net_rap_user(struct net_context *c, int argc, const char **argv) { int ret = -1; - struct functable3 func[] = { + struct functable func[] = { { "add", rap_user_add, @@ -911,7 +911,7 @@ int net_rap_user(struct net_context *c, int argc, const char **argv) goto done; } - ret = net_run_function3(c, argc, argv, "net rap user", func); + ret = net_run_function(c, argc, argv, "net rap user", func); done: if (ret != 0) { DEBUG(1, ("Net user returned: %d\n", ret)); @@ -977,7 +977,7 @@ static int rap_group_add(struct net_context *c, int argc, const char **argv) int net_rap_group(struct net_context *c, int argc, const char **argv) { - struct functable3 func[] = { + struct functable func[] = { { "add", rap_group_add, @@ -1022,7 +1022,7 @@ int net_rap_group(struct net_context *c, int argc, const char **argv) return ret; } - return net_run_function3(c, argc, argv, "net rap group", func); + return net_run_function(c, argc, argv, "net rap group", func); } int net_rap_groupmember_usage(struct net_context *c, int argc, const char **argv) @@ -1090,7 +1090,7 @@ static int rap_groupmember_list(struct net_context *c, int argc, const char **ar int net_rap_groupmember(struct net_context *c, int argc, const char **argv) { - struct functable3 func[] = { + struct functable func[] = { { "add", rap_groupmember_add, @@ -1118,7 +1118,7 @@ int net_rap_groupmember(struct net_context *c, int argc, const char **argv) {NULL, NULL, 0, NULL, NULL} }; - return net_run_function3(c, argc, argv, "net rap groupmember", func); + return net_run_function(c, argc, argv, "net rap groupmember", func); } int net_rap_validate_usage(struct net_context *c, int argc, const char **argv) @@ -1168,7 +1168,7 @@ static void service_fn(const char *service_name, const char *dummy, int net_rap_service(struct net_context *c, int argc, const char **argv) { - struct functable3 func[] = { + struct functable func[] = { { "start", rap_service_start, @@ -1212,7 +1212,7 @@ int net_rap_service(struct net_context *c, int argc, const char **argv) return ret; } - return net_run_function3(c, argc, argv, "net rap service", func); + return net_run_function(c, argc, argv, "net rap service", func); } int net_rap_password_usage(struct net_context *c, int argc, const char **argv) @@ -1261,7 +1261,7 @@ int net_rap_admin(struct net_context *c, int argc, const char **argv) int net_rap(struct net_context *c, int argc, const char **argv) { - struct functable3 func[] = { + struct functable func[] = { { "file", net_rap_file, @@ -1369,6 +1369,6 @@ int net_rap(struct net_context *c, int argc, const char **argv) {NULL, NULL, 0, NULL, NULL} }; - return net_run_function3(c, argc, argv, "net rap", func); + return net_run_function(c, argc, argv, "net rap", func); } diff --git a/source3/utils/net_registry.c b/source3/utils/net_registry.c index 00cca0855a..26710b3580 100644 --- a/source3/utils/net_registry.c +++ b/source3/utils/net_registry.c @@ -453,7 +453,7 @@ int net_registry(struct net_context *c, int argc, const char **argv) { int ret = -1; - struct functable3 func[] = { + struct functable func[] = { { "enumerate", net_registry_enumerate, @@ -525,7 +525,7 @@ int net_registry(struct net_context *c, int argc, const char **argv) return -1; } - ret = net_run_function3(c, argc, argv, "net registry", func); + ret = net_run_function(c, argc, argv, "net registry", func); return ret; } diff --git a/source3/utils/net_rpc.c b/source3/utils/net_rpc.c index 5f6c9428b7..fe30f790b8 100644 --- a/source3/utils/net_rpc.c +++ b/source3/utils/net_rpc.c @@ -1178,7 +1178,7 @@ int net_rpc_user(struct net_context *c, int argc, const char **argv) { NET_API_STATUS status; - struct functable3 func[] = { + struct functable func[] = { { "add", rpc_user_add, @@ -1243,7 +1243,7 @@ int net_rpc_user(struct net_context *c, int argc, const char **argv) argc, argv); } - return net_run_function3(c, argc, argv, "net rpc user", func); + return net_run_function(c, argc, argv, "net rpc user", func); } static NTSTATUS rpc_sh_user_list(struct net_context *c, @@ -3020,7 +3020,7 @@ int net_rpc_group(struct net_context *c, int argc, const char **argv) { NET_API_STATUS status; - struct functable3 func[] = { + struct functable func[] = { { "add", rpc_group_add, @@ -3102,7 +3102,7 @@ int net_rpc_group(struct net_context *c, int argc, const char **argv) argc, argv); } - return net_run_function3(c, argc, argv, "net rpc group", func); + return net_run_function(c, argc, argv, "net rpc group", func); } /****************************************************************************/ @@ -4084,7 +4084,7 @@ static int rpc_share_migrate_all(struct net_context *c, int argc, static int rpc_share_migrate(struct net_context *c, int argc, const char **argv) { - struct functable3 func[] = { + struct functable func[] = { { "all", rpc_share_migrate_all, @@ -4122,7 +4122,7 @@ static int rpc_share_migrate(struct net_context *c, int argc, const char **argv) net_mode_share = NET_MODE_SHARE_MIGRATE; - return net_run_function3(c, argc, argv, "net rpc share migrate", func); + return net_run_function(c, argc, argv, "net rpc share migrate", func); } struct full_alias { @@ -4926,7 +4926,7 @@ int net_usersidlist_usage(struct net_context *c, int argc, const char **argv) int net_rpc_share(struct net_context *c, int argc, const char **argv) { - struct functable3 func[] = { + struct functable func[] = { { "add", rpc_share_add, @@ -4986,7 +4986,7 @@ int net_rpc_share(struct net_context *c, int argc, const char **argv) argc, argv); } - return net_run_function3(c, argc, argv, "net rpc share", func); + return net_run_function(c, argc, argv, "net rpc share", func); } static NTSTATUS rpc_sh_share_list(struct net_context *c, @@ -5288,7 +5288,7 @@ static int rpc_file_user(struct net_context *c, int argc, const char **argv) int net_rpc_file(struct net_context *c, int argc, const char **argv) { - struct functable3 func[] = { + struct functable func[] = { { "close", rpc_file_close, @@ -5332,7 +5332,7 @@ int net_rpc_file(struct net_context *c, int argc, const char **argv) argc, argv); } - return net_run_function3(c, argc, argv, "net rpc file", func); + return net_run_function(c, argc, argv, "net rpc file", func); } /** @@ -6699,7 +6699,7 @@ static int rpc_trustdom_list(struct net_context *c, int argc, const char **argv) static int rpc_trustdom(struct net_context *c, int argc, const char **argv) { - struct functable3 func[] = { + struct functable func[] = { { "add", rpc_trustdom_add, @@ -6751,7 +6751,7 @@ static int rpc_trustdom(struct net_context *c, int argc, const char **argv) {NULL, NULL, 0, NULL, NULL} }; - return net_run_function3(c, argc, argv, "net rpc trustdom", func); + return net_run_function(c, argc, argv, "net rpc trustdom", func); } /** @@ -7046,7 +7046,7 @@ int rpc_printer_migrate(struct net_context *c, int argc, const char **argv) rpc_printer_migrate_drivers_internals, the printer-queue already *has* to exist */ - struct functable3 func[] = { + struct functable func[] = { { "all", rpc_printer_migrate_all, @@ -7098,7 +7098,7 @@ int rpc_printer_migrate(struct net_context *c, int argc, const char **argv) {NULL, NULL, 0, NULL, NULL} }; - return net_run_function3(c, argc, argv, "net rpc printer migrate",func); + return net_run_function(c, argc, argv, "net rpc printer migrate",func); } @@ -7265,7 +7265,7 @@ static int rpc_printer_publish(struct net_context *c, int argc, const char **argv) { - struct functable3 func[] = { + struct functable func[] = { { "publish", rpc_printer_publish_publish, @@ -7315,7 +7315,7 @@ static int rpc_printer_publish(struct net_context *c, int argc, argc, argv); } - return net_run_function3(c, argc, argv, "net rpc printer publish",func); + return net_run_function(c, argc, argv, "net rpc printer publish",func); } @@ -7369,7 +7369,7 @@ int rpc_printer_usage(struct net_context *c, int argc, const char **argv) **/ int net_rpc_printer(struct net_context *c, int argc, const char **argv) { - struct functable3 func[] = { + struct functable func[] = { { "list", rpc_printer_list, @@ -7418,7 +7418,7 @@ int net_rpc_printer(struct net_context *c, int argc, const char **argv) argc, argv); } - return net_run_function3(c, argc, argv, "net rpc printer", func); + return net_run_function(c, argc, argv, "net rpc printer", func); } /** @@ -7432,7 +7432,7 @@ int net_rpc_printer(struct net_context *c, int argc, const char **argv) int net_rpc(struct net_context *c, int argc, const char **argv) { - struct functable3 func[] = { + struct functable func[] = { { "audit", net_rpc_audit, @@ -7612,5 +7612,5 @@ int net_rpc(struct net_context *c, int argc, const char **argv) }, {NULL, NULL, 0, NULL, NULL} }; - return net_run_function3(c, argc, argv, "net rpc", func); + return net_run_function(c, argc, argv, "net rpc", func); } diff --git a/source3/utils/net_rpc_audit.c b/source3/utils/net_rpc_audit.c index 74e7cc5f0b..5a5110fadc 100644 --- a/source3/utils/net_rpc_audit.c +++ b/source3/utils/net_rpc_audit.c @@ -446,7 +446,7 @@ static int rpc_audit_list(struct net_context *c, int argc, const char **argv) int net_rpc_audit(struct net_context *c, int argc, const char **argv) { - struct functable3 func[] = { + struct functable func[] = { { "get", rpc_audit_get, @@ -490,5 +490,5 @@ int net_rpc_audit(struct net_context *c, int argc, const char **argv) {NULL, NULL, 0, NULL, NULL} }; - return net_run_function3(c, argc, argv, "net rpc audit", func); + return net_run_function(c, argc, argv, "net rpc audit", func); } diff --git a/source3/utils/net_rpc_registry.c b/source3/utils/net_rpc_registry.c index 0d7d46fb98..ff620897e7 100644 --- a/source3/utils/net_rpc_registry.c +++ b/source3/utils/net_rpc_registry.c @@ -1215,7 +1215,7 @@ static int rpc_registry_getsd(struct net_context *c, int argc, const char **argv int net_rpc_registry(struct net_context *c, int argc, const char **argv) { - struct functable3 func[] = { + struct functable func[] = { { "enumerate", rpc_registry_enumerate, @@ -1307,5 +1307,5 @@ int net_rpc_registry(struct net_context *c, int argc, const char **argv) {NULL, NULL, 0, NULL, NULL} }; - return net_run_function3(c, argc, argv, "net rpc registry", func); + return net_run_function(c, argc, argv, "net rpc registry", func); } diff --git a/source3/utils/net_rpc_rights.c b/source3/utils/net_rpc_rights.c index c359f97bd0..9991043594 100644 --- a/source3/utils/net_rpc_rights.c +++ b/source3/utils/net_rpc_rights.c @@ -623,7 +623,7 @@ static int rpc_rights_revoke(struct net_context *c, int argc, const char **argv) int net_rpc_rights(struct net_context *c, int argc, const char **argv) { - struct functable3 func[] = { + struct functable func[] = { { "list", rpc_rights_list, @@ -651,7 +651,7 @@ int net_rpc_rights(struct net_context *c, int argc, const char **argv) {NULL, NULL, 0, NULL, NULL} }; - return net_run_function3(c, argc, argv, "net rpc rights", func); + return net_run_function(c, argc, argv, "net rpc rights", func); } static NTSTATUS rpc_sh_rights_list(struct net_context *c, diff --git a/source3/utils/net_rpc_service.c b/source3/utils/net_rpc_service.c index 8a725598c0..5842c800c3 100644 --- a/source3/utils/net_rpc_service.c +++ b/source3/utils/net_rpc_service.c @@ -669,7 +669,7 @@ static int rpc_service_status(struct net_context *c, int argc, const char **argv int net_rpc_service(struct net_context *c, int argc, const char **argv) { - struct functable3 func[] = { + struct functable func[] = { { "list", rpc_service_list, @@ -721,5 +721,5 @@ int net_rpc_service(struct net_context *c, int argc, const char **argv) {NULL, NULL, 0, NULL, NULL} }; - return net_run_function3(c, argc, argv, "net rpc service",func); + return net_run_function(c, argc, argv, "net rpc service",func); } diff --git a/source3/utils/net_sam.c b/source3/utils/net_sam.c index 140bc53719..2183ed5efc 100644 --- a/source3/utils/net_sam.c +++ b/source3/utils/net_sam.c @@ -340,7 +340,7 @@ static int net_sam_set_comment(struct net_context *c, int argc, static int net_sam_set(struct net_context *c, int argc, const char **argv) { - struct functable3 func[] = { + struct functable func[] = { { "homedir", net_sam_set_homedir, @@ -440,7 +440,7 @@ static int net_sam_set(struct net_context *c, int argc, const char **argv) {NULL, NULL, 0, NULL, NULL} }; - return net_run_function3(c, argc, argv, "net sam set", func); + return net_run_function(c, argc, argv, "net sam set", func); } /* @@ -587,7 +587,7 @@ static int net_sam_policy_list(struct net_context *c, int argc, const char **arg static int net_sam_policy(struct net_context *c, int argc, const char **argv) { - struct functable3 func[] = { + struct functable func[] = { { "list", net_sam_policy_list, @@ -615,7 +615,7 @@ static int net_sam_policy(struct net_context *c, int argc, const char **argv) {NULL, NULL, 0, NULL, NULL} }; - return net_run_function3(c, argc, argv, "net sam policy", func); + return net_run_function(c, argc, argv, "net sam policy", func); } extern PRIVS privs[]; @@ -740,7 +740,7 @@ static int net_sam_rights_revoke(struct net_context *c, int argc, const char **a static int net_sam_rights(struct net_context *c, int argc, const char **argv) { - struct functable3 func[] = { + struct functable func[] = { { "list", net_sam_rights_list, @@ -767,7 +767,7 @@ static int net_sam_rights(struct net_context *c, int argc, const char **argv) }, {NULL, NULL, 0, NULL, NULL} }; - return net_run_function3(c, argc, argv, "net sam rights", func); + return net_run_function(c, argc, argv, "net sam rights", func); } /* @@ -1316,7 +1316,7 @@ static int net_sam_list_workstations(struct net_context *c, int argc, static int net_sam_list(struct net_context *c, int argc, const char **argv) { - struct functable3 func[] = { + struct functable func[] = { { "users", net_sam_list_users, @@ -1360,7 +1360,7 @@ static int net_sam_list(struct net_context *c, int argc, const char **argv) {NULL, NULL, 0, NULL, NULL} }; - return net_run_function3(c, argc, argv, "net sam list", func); + return net_run_function(c, argc, argv, "net sam list", func); } /* @@ -1808,7 +1808,7 @@ failed: **********************************************************/ int net_sam(struct net_context *c, int argc, const char **argv) { - struct functable3 func[] = { + struct functable func[] = { { "createbuiltingroup", net_sam_createbuiltingroup, @@ -1933,6 +1933,6 @@ int net_sam(struct net_context *c, int argc, const char **argv) "work\n"); } - return net_run_function3(c, argc, argv, "net sam", func); + return net_run_function(c, argc, argv, "net sam", func); } diff --git a/source3/utils/net_status.c b/source3/utils/net_status.c index 0bd698a8e7..4e355e48b3 100644 --- a/source3/utils/net_status.c +++ b/source3/utils/net_status.c @@ -244,7 +244,7 @@ static int net_status_shares(struct net_context *c, int argc, const char **argv) int net_status(struct net_context *c, int argc, const char **argv) { - struct functable3 func[] = { + struct functable func[] = { { "sessions", net_status_sessions, @@ -265,5 +265,5 @@ int net_status(struct net_context *c, int argc, const char **argv) }, {NULL, NULL, 0, NULL, NULL} }; - return net_run_function3(c, argc, argv, "net status", func); + return net_run_function(c, argc, argv, "net status", func); } diff --git a/source3/utils/net_time.c b/source3/utils/net_time.c index 43f907ddb7..f569538fac 100644 --- a/source3/utils/net_time.c +++ b/source3/utils/net_time.c @@ -180,7 +180,7 @@ static int net_time_zone(struct net_context *c, int argc, const char **argv) int net_time(struct net_context *c, int argc, const char **argv) { time_t t; - struct functable3 func[] = { + struct functable func[] = { { "system", net_time_system, @@ -209,7 +209,7 @@ int net_time(struct net_context *c, int argc, const char **argv) }; if (argc != 0) { - return net_run_function3(c, argc, argv, "net time", func); + return net_run_function(c, argc, argv, "net time", func); } if (c->display_usage) { diff --git a/source3/utils/net_usershare.c b/source3/utils/net_usershare.c index 595fb9f5ca..8f263c636c 100644 --- a/source3/utils/net_usershare.c +++ b/source3/utils/net_usershare.c @@ -1012,7 +1012,7 @@ int net_usershare(struct net_context *c, int argc, const char **argv) { SMB_STRUCT_DIR *dp; - struct functable3 func[] = { + struct functable func[] = { { "add", net_usershare_add, @@ -1069,5 +1069,5 @@ int net_usershare(struct net_context *c, int argc, const char **argv) } sys_closedir(dp); - return net_run_function3(c, argc, argv, "net usershare", func); + return net_run_function(c, argc, argv, "net usershare", func); } diff --git a/source3/utils/net_util.c b/source3/utils/net_util.c index 695d285390..6029231d74 100644 --- a/source3/utils/net_util.c +++ b/source3/utils/net_util.c @@ -546,57 +546,8 @@ const char *net_prompt_pass(struct net_context *c, const char *user) return pass; } -/* - run a function from a function table. If not found then - call the specified usage function -*/ int net_run_function(struct net_context *c, int argc, const char **argv, - struct functable *table, - int (*usage_fn)(struct net_context *c, - int argc, const char **argv)) -{ - int i; - - if (argc < 1) { - d_printf("\nUsage: \n"); - return usage_fn(c, argc, argv); - } - for (i=0; table[i].funcname; i++) { - if (StrCaseCmp(argv[0], table[i].funcname) == 0) - return table[i].fn(c, argc-1, argv+1); - } - d_fprintf(stderr, "No command: %s\n", argv[0]); - return usage_fn(c, argc, argv); -} - -/* - * run a function from a function table. - */ -int net_run_function2(struct net_context *c, int argc, const char **argv, - const char *whoami, struct functable2 *table) -{ - int i; - - if (argc != 0) { - for (i=0; table[i].funcname; i++) { - if (StrCaseCmp(argv[0], table[i].funcname) == 0) - return table[i].fn(c, argc-1, argv+1); - } - } - - d_fprintf(stderr, "Invalid command: %s %s\n", whoami, - (argc > 0)?argv[0]:""); - d_printf("Usage:\n"); - for (i=0; table[i].funcname != NULL; i++) { - d_printf("%s %-15s %s\n", whoami, table[i].funcname, - table[i].helptext); - } - - return -1; -} - -int net_run_function3(struct net_context *c, int argc, const char **argv, - const char *whoami, struct functable3 *table) + const char *whoami, struct functable *table) { int i; if (argc != 0) { @@ -622,7 +573,7 @@ int net_run_function3(struct net_context *c, int argc, const char **argv, return c->display_usage?0:-1; } -void net_display_usage_from_functable(struct functable3 *table) +void net_display_usage_from_functable(struct functable *table) { int i; for (i=0; table[i].funcname != NULL; i++) { |