Import Upstream version 1.8.5
[hcoop/debian/openafs.git] / src / kopenafs / test-setpag.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 /*
11 * Test the kopenafs setpag support.
12 */
13
14 #include <errno.h>
15 #include <stdio.h>
16 #include <unistd.h>
17
18 #include <kopenafs.h>
19
20 int
21 main(int argc, char *argv[])
22 {
23 int status;
24
25 if (k_hasafs()) {
26 printf("%s in a PAG\n", k_haspag() ? "Currently" : "Not currently");
27 printf("Running k_setpag\n");
28 status = k_setpag();
29 printf("Status: %d, errno: %d\n", status, errno);
30 if (!k_haspag())
31 printf("Error: not in a PAG after k_setpag()\n");
32 if (argc > 1) {
33 argv++;
34 execvp(argv[0], argv);
35 }
36 } else {
37 printf("AFS apparently not running\n");
38 }
39 return 0;
40 }