]> andersk Git - moira.git/blobdiff - lib/mr_access.c
Command line printer manipulation client, and build goo.
[moira.git] / lib / mr_access.c
index c728c662477439bf9e241aa7402c4533f57438e1..ac70e3e79149dc1bab626c31b3ee48d0a786f4b2 100644 (file)
@@ -1,81 +1,46 @@
-/*
- *     $Source$
- *     $Author$
- *     $Header$
- *
- *     Copyright (C) 1987 by the Massachusetts Institute of Technology
+/* $Id$
  *
- *     $Log$
- *     Revision 1.3  1988-04-19 12:41:39  mar
- *     pass version number on queries
+ * Check access to a Moira query
  *
- * Revision 1.2  87/08/02  21:48:35  wesommer
- * Got direction of test incorrect.
- * 
- * Revision 1.1  87/06/23  16:13:00  wesommer
- * Initial revision
- * 
+ * Copyright (C) 1987-1998 by the Massachusetts Institute of Technology
+ * For copying and distribution information, please see the file
+ * <mit-copyright.h>.
  */
 
-#ifndef lint
-static char *rcsid_sms_access_c = "$Header$";
-#endif lint
+#include <mit-copyright.h>
+#include <moira.h>
+#include "mr_private.h"
+
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
 
-#include "sms_private.h"
+RCSID("$Header$");
 
 /*
  * Check access to a named query.
  */
-int sms_access(name, argc, argv)
-    char *name;                        /* Query name */
-    int argc;                  /* Arg count */
-    char **argv;               /* Args */
-{
-    register char **nargv = (char **)malloc(sizeof(char *) * (argc+1));
-    register int status = 0;
-    nargv[0] = name;
-    bcopy((char *)argv, (char *)(nargv+1), sizeof(char *) * argc);
-    status = sms_access_internal(argc+1, nargv);
-    free(nargv);
-    return status;
-}
-/*
- * Check access to a named query, where the query name is argv[0]
- * and the arguments are the rest of argv[].
- */
-int sms_access_internal(argc, argv)
-    int argc;                  /* Arg count */
-    char **argv;               /* Args */
+int mr_access(char *name, int argc, char **argv)
 {
-    int status;
-    sms_params params_st;
-    register sms_params *params = NULL;
-    sms_params *reply = NULL;
-    
-    CHECK_CONNECTED;
+  mr_params params, reply;
+  int status;
 
-    params = &params_st;
-    params->sms_version_no = sending_version_no;
-    params->sms_procno = SMS_ACCESS;
-    params->sms_argc = argc;
-    params->sms_argl = NULL;
-    params->sms_argv = argv;
-       
-    if ((status = sms_do_call(params, &reply)) == 0)
-       status = reply->sms_status;
+  CHECK_CONNECTED;
 
-    sms_destroy_reply(reply);
+  params.u.mr_procno = MR_ACCESS;
+  params.mr_argc = argc + 1;
+  params.mr_argv = malloc(sizeof(char *) * (argc + 1));
+  if (!params.mr_argv)
+    return ENOMEM;
+  params.mr_argv[0] = name;
+  memcpy(params.mr_argv + 1, argv, sizeof(char *) * argc);
+  params.mr_argl = NULL;
 
-    return status;
-}
+  if ((status = mr_do_call(&params, &reply)) == MR_SUCCESS)
+    status = reply.u.mr_status;
 
-/*
- * Local Variables:
- * mode: c
- * c-indent-level: 4
- * c-continued-statement-offset: 4
- * c-brace-offset: -4
- * c-argdecl-indent: 4
- * c-label-offset: -4
- * End:
- */
+  mr_destroy_reply(reply);
+  free(params.mr_argv);
+
+  return status;
+}
This page took 0.03465 seconds and 4 git commands to generate.