]> andersk Git - moira.git/blob - lib/mr_access.c
pass version number on queries
[moira.git] / lib / mr_access.c
1 /*
2  *      $Source$
3  *      $Author$
4  *      $Header$
5  *
6  *      Copyright (C) 1987 by the Massachusetts Institute of Technology
7  *
8  *      $Log$
9  *      Revision 1.3  1988-04-19 12:41:39  mar
10  *      pass version number on queries
11  *
12  * Revision 1.2  87/08/02  21:48:35  wesommer
13  * Got direction of test incorrect.
14  * 
15  * Revision 1.1  87/06/23  16:13:00  wesommer
16  * Initial revision
17  * 
18  */
19
20 #ifndef lint
21 static char *rcsid_sms_access_c = "$Header$";
22 #endif lint
23
24 #include "sms_private.h"
25
26 /*
27  * Check access to a named query.
28  */
29 int sms_access(name, argc, argv)
30     char *name;                 /* Query name */
31     int argc;                   /* Arg count */
32     char **argv;                /* Args */
33 {
34     register char **nargv = (char **)malloc(sizeof(char *) * (argc+1));
35     register int status = 0;
36     nargv[0] = name;
37     bcopy((char *)argv, (char *)(nargv+1), sizeof(char *) * argc);
38     status = sms_access_internal(argc+1, nargv);
39     free(nargv);
40     return status;
41 }
42 /*
43  * Check access to a named query, where the query name is argv[0]
44  * and the arguments are the rest of argv[].
45  */
46 int sms_access_internal(argc, argv)
47     int argc;                   /* Arg count */
48     char **argv;                /* Args */
49 {
50     int status;
51     sms_params params_st;
52     register sms_params *params = NULL;
53     sms_params *reply = NULL;
54     
55     CHECK_CONNECTED;
56
57     params = &params_st;
58     params->sms_version_no = sending_version_no;
59     params->sms_procno = SMS_ACCESS;
60     params->sms_argc = argc;
61     params->sms_argl = NULL;
62     params->sms_argv = argv;
63         
64     if ((status = sms_do_call(params, &reply)) == 0)
65         status = reply->sms_status;
66
67     sms_destroy_reply(reply);
68
69     return status;
70 }
71
72 /*
73  * Local Variables:
74  * mode: c
75  * c-indent-level: 4
76  * c-continued-statement-offset: 4
77  * c-brace-offset: -4
78  * c-argdecl-indent: 4
79  * c-label-offset: -4
80  * End:
81  */
This page took 0.051626 seconds and 5 git commands to generate.