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