[SCM] Samba Shared Repository - branch v3-3-test updated -
release-3-2-0pre2-4178-g5db15bc
Günther Deschner
gd at samba.org
Fri Sep 26 18:54:48 GMT 2008
The branch, v3-3-test has been updated
via 5db15bc0f67b478ef95ec3e327f7a40d90c535bd (commit)
from 29942b7043c1a31ad4fb76d01ab19fd3dbf26f0a (commit)
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-3-test
- Log -----------------------------------------------------------------
commit 5db15bc0f67b478ef95ec3e327f7a40d90c535bd
Author: Kai Blin <kai at samba.org>
Date: Wed Sep 24 23:23:01 2008 +0200
net: Make share type lookup a function.
-----------------------------------------------------------------------
Summary of changes:
source/utils/net_proto.h | 2 ++
source/utils/net_rap.c | 11 ++---------
source/utils/net_rpc.c | 4 +---
source/utils/net_util.c | 12 ++++++++++++
4 files changed, 17 insertions(+), 12 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source/utils/net_proto.h b/source/utils/net_proto.h
index 1e355e5..ee4388f 100644
--- a/source/utils/net_proto.h
+++ b/source/utils/net_proto.h
@@ -471,6 +471,8 @@ int net_run_function(struct net_context *c, int argc, const char **argv,
const char *whoami, struct functable *table);
void net_display_usage_from_functable(struct functable *table);
+const char *net_share_type_str(int num_type);
+
/* The following definitions come from utils/netlookup.c */
NTSTATUS net_lookup_name_from_sid(struct net_context *c,
diff --git a/source/utils/net_rap.c b/source/utils/net_rap.c
index 883524d..32f4dd3 100644
--- a/source/utils/net_rap.c
+++ b/source/utils/net_rap.c
@@ -34,13 +34,6 @@
#define ERRMSG_BOTH_SERVER_IPADDRESS "\nTarget server and IP address both "\
"specified. Do not set both at the same time. The target IP address was used\n"
-const char *share_type[] = {
- "Disk",
- "Print",
- "Dev",
- "IPC"
-};
-
static int errmsg_not_implemented(void)
{
d_printf("\nNot implemented\n");
@@ -201,7 +194,7 @@ static void long_share_fn(const char *share_name, uint32 type,
const char *comment, void *state)
{
d_printf("%-12s %-8.8s %-50s\n",
- share_name, share_type[type], comment);
+ share_name, net_share_type_str(type), comment);
}
static void share_fn(const char *share_name, uint32 type,
@@ -388,7 +381,7 @@ static void display_conns_func(uint16 conn_id, uint16 conn_type, uint16 opens,
const char *username, const char *netname)
{
d_printf("%-14.14s %-8.8s %5d\n",
- netname, share_type[conn_type], opens);
+ netname, net_share_type_str(conn_type), opens);
}
static int rap_session_info(struct net_context *c, int argc, const char **argv)
diff --git a/source/utils/net_rpc.c b/source/utils/net_rpc.c
index a849ec4..0e91144 100644
--- a/source/utils/net_rpc.c
+++ b/source/utils/net_rpc.c
@@ -26,8 +26,6 @@
static int net_mode_share;
static bool sync_files(struct copy_clistate *cp_clistate, const char *mask);
-extern const char *share_type[];
-
/**
* @file net_rpc.c
*
@@ -2876,7 +2874,7 @@ static void display_share_info_1(struct net_context *c,
if (c->opt_long_list_entries) {
d_printf("%-12s %-8.8s %-50s\n",
r->shi1_netname,
- share_type[r->shi1_type & ~(STYPE_TEMPORARY|STYPE_HIDDEN)],
+ net_share_type_str(r->shi1_type & ~(STYPE_TEMPORARY|STYPE_HIDDEN)),
r->shi1_remark);
} else {
d_printf("%s\n", r->shi1_netname);
diff --git a/source/utils/net_util.c b/source/utils/net_util.c
index 88850d2..fbb3c24 100644
--- a/source/utils/net_util.c
+++ b/source/utils/net_util.c
@@ -2,6 +2,7 @@
* Unix SMB/CIFS implementation.
* Helper routines for net
* Copyright (C) Volker Lendecke 2006
+ * Copyright (C) Kai Blin 2008
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -595,3 +596,14 @@ void net_display_usage_from_functable(struct functable *table)
d_printf("%s\n", table[i].usage);
}
}
+
+const char *net_share_type_str(int num_type)
+{
+ switch(num_type) {
+ case 0: return "Disk";
+ case 1: return "Print";
+ case 2: return "Dev";
+ case 3: return "IPC";
+ default: return "Unknown";
+ }
+}
--
Samba Shared Repository
More information about the samba-cvs
mailing list