]>
Commit | Line | Data |
---|---|---|
1 | /* | |
2 | * $Source$ | |
3 | * $Author$ | |
4 | * $Header$ | |
5 | * | |
6 | * Copyright (C) 1987 by the Massachusetts Institute of Technology | |
7 | * For copying and distribution information, please see the file | |
8 | * <mit-copyright.h>. | |
9 | */ | |
10 | ||
11 | #ifndef lint | |
12 | static char *rcsid_sms_access_c = "$Header$"; | |
13 | #endif lint | |
14 | ||
15 | #include <mit-copyright.h> | |
16 | #include "sms_private.h" | |
17 | ||
18 | /* | |
19 | * Check access to a named query. | |
20 | */ | |
21 | int sms_access(name, argc, argv) | |
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); | |
30 | status = sms_access_internal(argc+1, nargv); | |
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 | */ | |
38 | int sms_access_internal(argc, argv) | |
39 | int argc; /* Arg count */ | |
40 | char **argv; /* Args */ | |
41 | { | |
42 | int status; | |
43 | sms_params params_st; | |
44 | register sms_params *params = NULL; | |
45 | sms_params *reply = NULL; | |
46 | ||
47 | CHECK_CONNECTED; | |
48 | ||
49 | params = ¶ms_st; | |
50 | params->sms_version_no = sending_version_no; | |
51 | params->sms_procno = SMS_ACCESS; | |
52 | params->sms_argc = argc; | |
53 | params->sms_argl = NULL; | |
54 | params->sms_argv = argv; | |
55 | ||
56 | if ((status = sms_do_call(params, &reply)) == 0) | |
57 | status = reply->sms_status; | |
58 | ||
59 | sms_destroy_reply(reply); | |
60 | ||
61 | return status; | |
62 | } | |
63 | ||
64 | /* | |
65 | * Local Variables: | |
66 | * mode: c | |
67 | * c-indent-level: 4 | |
68 | * c-continued-statement-offset: 4 | |
69 | * c-brace-offset: -4 | |
70 | * c-argdecl-indent: 4 | |
71 | * c-label-offset: -4 | |
72 | * End: | |
73 | */ |