venus: Remove dedebug
[openafs.git] / src / log / test / gettoktest.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
13
14 #include <itc.h>
15 #include <stdio.h>
16 #include <sys/file.h>
17 #include <r/xdr.h>
18 #include <afs/comauth.h>
19 #include <errno.h>
20
21 extern int errno;
22
23 main(argc, argv)
24      int argc;
25      char **argv;
26 {                               /*main program */
27
28     int i;                      /*Cell entry number */
29     int useCellEntry;           /*Do a cellular call? */
30     ClearToken cToken;          /*Clear token returned */
31     SecretToken sToken;         /*Secret token returned */
32     char cellID[64];            /*Cell ID returned */
33     int isPrimary;              /*Is cell ID primary? */
34     int rc;                     /*Return value from U_CellGetLocalTokens */
35
36     printf("\nTesting the cellular Venus token interface.\n\n");
37     printf("Getting tokens, non-cellular request:\n");
38     useCellEntry = 0;
39     rc = U_CellGetLocalTokens(useCellEntry, i, &cToken, &sToken, cellID,
40                               &isPrimary);
41     if (rc)
42         printf("        **Error getting local tokens: %d, errno is %d\n", rc,
43                errno);
44     else
45         printf("        Got local tokens: Vice ID is %d\n", cToken.ViceId);
46
47     printf("\nGetting tokens, cellular request.\n");
48     useCellEntry = 1;
49     rc = 0;
50     for (i = 0; (i <= 1000) && !(rc && errno == EDOM); i++) {
51         printf("  Cell entry %2d: ", i);
52         rc = U_CellGetLocalTokens(useCellEntry, i, &cToken, &sToken, cellID,
53                                   &isPrimary);
54         if (rc) {
55             /*Something didn't go well.  Print out errno, unless we got an EDOM */
56             if (errno == EDOM)
57                 printf("--End of list--\n");
58             else
59                 printf("** Error in call, errno is %d\n", errno);
60         } else
61             printf("Vice ID %4d in cell '%s' [isPrimary=%d]\n", cToken.ViceId,
62                    cellID, isPrimary);
63     }
64
65     printf("\nEnd of cellular Venus token interface test.\n\n");
66
67 }                               /*main program */