]> andersk Git - moira.git/blame - lib/mr_access.c
eliminate use of the `register' keyword: let the compiler decide
[moira.git] / lib / mr_access.c
CommitLineData
612ef603 1/*
2 * $Source$
3 * $Author$
4 * $Header$
5 *
8defc06b 6 * Copyright (C) 1987, 1990 by the Massachusetts Institute of Technology
babbc197 7 * For copying and distribution information, please see the file
8 * <mit-copyright.h>.
612ef603 9 */
10
11#ifndef lint
12static char *rcsid_sms_access_c = "$Header$";
a43ce477 13#endif
612ef603 14
babbc197 15#include <mit-copyright.h>
8defc06b 16#include "mr_private.h"
8fd777cf 17#include <string.h>
a43ce477 18#include <stdlib.h>
612ef603 19
20/*
21 * Check access to a named query.
22 */
5eaef520 23int mr_access(char *name, int argc, char **argv)
612ef603 24{
44d12d58 25 char **nargv = malloc(sizeof(char *) * (argc + 1));
26 int status = 0;
5eaef520 27
28 nargv[0] = name;
29 memcpy(nargv + 1, argv, sizeof(char *) * argc);
30 status = mr_access_internal(argc + 1, nargv);
31 free(nargv);
32 return status;
612ef603 33}
5eaef520 34
612ef603 35/*
36 * Check access to a named query, where the query name is argv[0]
37 * and the arguments are the rest of argv[].
38 */
5eaef520 39int mr_access_internal(int argc, char **argv)
612ef603 40{
5eaef520 41 int status;
42 mr_params params_st;
44d12d58 43 mr_params *params = NULL;
5eaef520 44 mr_params *reply = NULL;
45
46 CHECK_CONNECTED;
47
48 params = &params_st;
49 params->mr_version_no = sending_version_no;
50 params->mr_procno = MR_ACCESS;
51 params->mr_argc = argc;
52 params->mr_argl = NULL;
53 params->mr_argv = argv;
612ef603 54
5eaef520 55 if ((status = mr_do_call(params, &reply)) == 0)
56 status = reply->mr_status;
612ef603 57
5eaef520 58 mr_destroy_reply(reply);
612ef603 59
5eaef520 60 return status;
612ef603 61}
This page took 1.856405 seconds and 5 git commands to generate.