a4341c19b5aeace79b224b2f8ebbb476201ad90d
[openafs.git] / src / finale / translate_et_nt.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 <afs/stds.h>
15 #include <stdio.h>
16
17 #include <afs/afs_Admin.h>
18 #include <afs/afs_utilAdmin.h>
19 #include <afs/afs_clientAdmin.h>
20
21
22 int
23 main(int argc, char **argv)
24 {
25     int i;
26     afs_status_t status;
27
28 #ifdef  AFS_AIX32_ENV
29     /*
30      * The following signal action for AIX is necessary so that in case of a
31      * crash (i.e. core is generated) we can include the user's data section
32      * in the core dump. Unfortunately, by default, only a partial core is
33      * generated which, in many cases, isn't too useful.
34      */
35     struct sigaction nsa;
36
37     sigemptyset(&nsa.sa_mask);
38     nsa.sa_handler = SIG_DFL;
39     nsa.sa_flags = SA_FULLDUMP;
40     sigaction(SIGSEGV, &nsa, NULL);
41 #endif
42
43     if (argc < 2) {
44         fprintf(stderr, "Usage is: %s [<code>]+\n", argv[0]);
45         exit(1);
46     }
47
48     if (!afsclient_Init(&status)) {
49         fprintf(stderr, "Unable to initialize error tables\n");
50         exit(1);
51     }
52
53     for (i = 1; i < argc; i++) {
54         const char *errText;
55         afs_status_t errStatus;
56
57         status = (afs_status_t) atoi(argv[i]);
58         util_AdminErrorCodeTranslate(status, 0, &errText, &errStatus);
59         printf("%d = %s\n", status, errText);
60     }
61     return 0;
62 }