]>
Commit | Line | Data |
---|---|---|
fa59b86f | 1 | /* $Id$ |
7ac48069 | 2 | * |
3 | * Check access to a Moira query | |
612ef603 | 4 | * |
7ac48069 | 5 | * Copyright (C) 1987-1998 by the Massachusetts Institute of Technology |
6 | * For copying and distribution information, please see the file | |
7 | * <mit-copyright.h>. | |
612ef603 | 8 | */ |
9 | ||
babbc197 | 10 | #include <mit-copyright.h> |
7ac48069 | 11 | #include <moira.h> |
8defc06b | 12 | #include "mr_private.h" |
7ac48069 | 13 | |
a3bbcc2b | 14 | #include <errno.h> |
a43ce477 | 15 | #include <stdlib.h> |
7ac48069 | 16 | #include <string.h> |
17 | ||
18 | RCSID("$Header$"); | |
19 | ||
612ef603 | 20 | /* |
21 | * Check access to a named query. | |
22 | */ | |
5eaef520 | 23 | int mr_access(char *name, int argc, char **argv) |
612ef603 | 24 | { |
85330553 | 25 | mr_params params, reply; |
5eaef520 | 26 | int status; |
5eaef520 | 27 | |
28 | CHECK_CONNECTED; | |
29 | ||
85330553 | 30 | params.u.mr_procno = MR_ACCESS; |
31 | params.mr_argc = argc + 1; | |
32 | params.mr_argv = malloc(sizeof(char *) * (argc + 1)); | |
33 | if (!params.mr_argv) | |
34 | return ENOMEM; | |
35 | params.mr_argv[0] = name; | |
36 | memcpy(params.mr_argv + 1, argv, sizeof(char *) * argc); | |
37 | params.mr_argl = NULL; | |
612ef603 | 38 | |
85330553 | 39 | if ((status = mr_do_call(¶ms, &reply)) == MR_SUCCESS) |
40 | status = reply.u.mr_status; | |
612ef603 | 41 | |
5eaef520 | 42 | mr_destroy_reply(reply); |
85330553 | 43 | free(params.mr_argv); |
612ef603 | 44 | |
5eaef520 | 45 | return status; |
612ef603 | 46 | } |