summaryrefslogtreecommitdiff
path: root/source3/utils/net_cache.c
diff options
context:
space:
mode:
authorKai Blin <kai@samba.org>2008-05-09 23:22:12 +0200
committerKai Blin <kai@samba.org>2008-05-10 09:22:27 +0200
commitf5769109447d8da0f09b102d444a816ad97a00dc (patch)
treefe7b470486ace083b3f48a54334a3db0bb9633d2 /source3/utils/net_cache.c
parent378527215e663c0c9d36c565a16723e0a1979ea0 (diff)
downloadsamba-f5769109447d8da0f09b102d444a816ad97a00dc.tar.gz
samba-f5769109447d8da0f09b102d444a816ad97a00dc.tar.bz2
samba-f5769109447d8da0f09b102d444a816ad97a00dc.zip
net: Remove globals
(This used to be commit 1e9319cf88b65a2a8d4f5099a1fe5297e405ed2e)
Diffstat (limited to 'source3/utils/net_cache.c')
-rw-r--r--source3/utils/net_cache.c30
1 files changed, 19 insertions, 11 deletions
diff --git a/source3/utils/net_cache.c b/source3/utils/net_cache.c
index 8e0f98ef7e..e59a534e4a 100644
--- a/source3/utils/net_cache.c
+++ b/source3/utils/net_cache.c
@@ -14,8 +14,8 @@
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
#include "includes.h"
#include "net.h"
@@ -145,10 +145,11 @@ static time_t parse_timeout(const char* timeout_str)
/**
* Add an entry to the cache. If it does exist, then set it.
*
+ * @param c A net_context structure
* @param argv key, value and timeout are passed in command line
* @return 0 on success, otherwise failure
**/
-static int net_cache_add(int argc, const char **argv)
+static int net_cache_add(struct net_context *c, int argc, const char **argv)
{
const char *keystr, *datastr, *timeout_str;
time_t timeout;
@@ -183,10 +184,11 @@ static int net_cache_add(int argc, const char **argv)
/**
* Delete an entry in the cache
*
+ * @param c A net_context structure
* @param argv key to delete an entry of
* @return 0 on success, otherwise failure
**/
-static int net_cache_del(int argc, const char **argv)
+static int net_cache_del(struct net_context *c, int argc, const char **argv)
{
const char *keystr = argv[0];
@@ -208,10 +210,11 @@ static int net_cache_del(int argc, const char **argv)
/**
* Get and display an entry from the cache
*
+ * @param c A net_context structure
* @param argv key to search an entry of
* @return 0 on success, otherwise failure
**/
-static int net_cache_get(int argc, const char **argv)
+static int net_cache_get(struct net_context *c, int argc, const char **argv)
{
const char* keystr = argv[0];
char* valuestr;
@@ -235,10 +238,11 @@ static int net_cache_get(int argc, const char **argv)
/**
* Search an entry/entries in the cache
*
+ * @param c A net_context structure
* @param argv key pattern to match the entries to
* @return 0 on success, otherwise failure
**/
-static int net_cache_search(int argc, const char **argv)
+static int net_cache_search(struct net_context *c, int argc, const char **argv)
{
const char* pattern;
@@ -256,10 +260,11 @@ static int net_cache_search(int argc, const char **argv)
/**
* List the contents of the cache
*
+ * @param c A net_context structure
* @param argv ignored in this functionailty
* @return always returns 0
**/
-static int net_cache_list(int argc, const char **argv)
+static int net_cache_list(struct net_context *c, int argc, const char **argv)
{
const char* pattern = "*";
gencache_iterate(print_cache_entry, NULL, pattern);
@@ -271,10 +276,11 @@ static int net_cache_list(int argc, const char **argv)
/**
* Flush the whole cache
*
+ * @param c A net_context structure
* @param argv ignored in this functionality
* @return always returns 0
**/
-static int net_cache_flush(int argc, const char **argv)
+static int net_cache_flush(struct net_context *c, int argc, const char **argv)
{
const char* pattern = "*";
gencache_iterate(delete_cache_entry, NULL, pattern);
@@ -286,10 +292,11 @@ static int net_cache_flush(int argc, const char **argv)
/**
* Short help
*
+ * @param c A net_context structure
* @param argv ignored in this functionality
* @return always returns -1
**/
-static int net_cache_usage(int argc, const char **argv)
+static int net_cache_usage(struct net_context *c, int argc, const char **argv)
{
d_printf(" net cache add \t add add new cache entry\n");
d_printf(" net cache del \t delete existing cache entry by key\n");
@@ -304,10 +311,11 @@ static int net_cache_usage(int argc, const char **argv)
/**
* Entry point to 'net cache' subfunctionality
*
+ * @param c A net_context structure
* @param argv arguments passed to further called functions
* @return whatever further functions return
**/
-int net_cache(int argc, const char **argv)
+int net_cache(struct net_context *c, int argc, const char **argv)
{
struct functable func[] = {
{"add", net_cache_add},
@@ -319,5 +327,5 @@ int net_cache(int argc, const char **argv)
{NULL, NULL}
};
- return net_run_function(argc, argv, func, net_cache_usage);
+ return net_run_function(c, argc, argv, func, net_cache_usage);
}