]> andersk Git - moira.git/blame - lib/mr_access.c
ANSIfy
[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$";
13#endif lint
14
babbc197 15#include <mit-copyright.h>
8defc06b 16#include "mr_private.h"
612ef603 17
18/*
19 * Check access to a named query.
20 */
8defc06b 21int mr_access(name, argc, argv)
612ef603 22 char *name; /* Query name */
23 int argc; /* Arg count */
24 char **argv; /* Args */
25{
26 register char **nargv = (char **)malloc(sizeof(char *) * (argc+1));
27 register int status = 0;
28 nargv[0] = name;
29 bcopy((char *)argv, (char *)(nargv+1), sizeof(char *) * argc);
8defc06b 30 status = mr_access_internal(argc+1, nargv);
612ef603 31 free(nargv);
32 return status;
33}
34/*
35 * Check access to a named query, where the query name is argv[0]
36 * and the arguments are the rest of argv[].
37 */
8defc06b 38int mr_access_internal(argc, argv)
612ef603 39 int argc; /* Arg count */
40 char **argv; /* Args */
41{
42 int status;
8defc06b 43 mr_params params_st;
44 register mr_params *params = NULL;
45 mr_params *reply = NULL;
612ef603 46
47 CHECK_CONNECTED;
48
49 params = &params_st;
8defc06b 50 params->mr_version_no = sending_version_no;
51 params->mr_procno = MR_ACCESS;
52 params->mr_argc = argc;
53 params->mr_argl = NULL;
54 params->mr_argv = argv;
612ef603 55
8defc06b 56 if ((status = mr_do_call(params, &reply)) == 0)
57 status = reply->mr_status;
612ef603 58
8defc06b 59 mr_destroy_reply(reply);
612ef603 60
61 return status;
62}
This page took 0.107831 seconds and 5 git commands to generate.