Import Upstream version 1.8.5
[hcoop/debian/openafs.git] / src / afsd / vsys.c
1 /*
2 * Copyright 2000, International Business Machines Corporation and others.
3 * All Rights Reserved.
4 *
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
8 */
9
10 #include <afsconfig.h>
11 #include <afs/param.h>
12 #include <stdio.h>
13 #include <stdlib.h>
14 #include <ctype.h>
15 #include <string.h>
16 #ifdef HAVE_UNISTD_H
17 #include <unistd.h>
18 #endif
19 #ifdef HAVE_STDINT_H
20 # include <stdint.h>
21 #endif
22
23
24 #include <afs/afs_args.h>
25
26 #include "AFS_component_version_number.c"
27
28 int
29 main(int argc, char **argv)
30 {
31 afs_int32 code;
32 int i, counter;
33 afs_int32 parms[6];
34 int numberFlag;
35
36 memset(&parms, 0, sizeof(parms));
37
38 if (argc < 2) {
39 printf("use: vsys <call number> <parms>\n");
40 exit(1);
41 }
42 numberFlag = 1;
43 counter = 0;
44 for (i = 1; i < argc; i++) {
45 if (numberFlag && argv[i][0] == '-') {
46 if (strcmp(argv[i], "-s") == 0)
47 numberFlag = 0;
48 else {
49 printf("bad switch %s\n", argv[i]);
50 exit(1);
51 }
52 } else if (numberFlag) {
53 parms[counter++] = atoi(argv[i]);
54 numberFlag = 1;
55 } else {
56 parms[counter++] = (intptr_t)argv[i];
57 numberFlag = 1;
58 }
59 }
60 #ifdef AFS_SYSCALL
61 code =
62 syscall(AFS_SYSCALL, parms[0], parms[1], parms[2], parms[3], parms[4],
63 parms[5]);
64 #else
65 code = -1;
66 #endif
67 printf("code %d\n", code);
68 return 0;
69 }