1: # include <ingres.h>
2: # include <access.h>
3: # include <sccs.h>
4:
5: SCCSID(@(#)printadmin.c 8.2 2/8/85)
6:
7: short tTdbu[100];
8: struct admin Admin;
9:
10: main(argc, argv)
11: int argc;
12: char *argv[];
13: {
14: register int i, fp;
15: register char *db;
16: extern char *Dbpath;
17: extern char *Parmvect[], *Flagvect[];
18:
19: argv[argc] = NULL;
20: # ifdef xSTR1
21: tTrace(argv, 'T', tTdbu, 100);
22: # endif
23:
24: i = initucode(argc, argv, TRUE, NULL, -1);
25: db = Parmvect[0];
26: switch (i)
27: {
28: case 0:
29: case INDIRECT:
30: break;
31:
32: case NODB:
33: case INDNODB:
34: printf("Database %s does not exist\n", db);
35: exit(-1);
36:
37: case NOACCESS:
38: printf("You are not authorized to access this database\n");
39: exit(-1);
40:
41: case INVALIDUSR:
42: printf("You are not a valid INGRES user\n");
43: exit(-1);
44:
45: case NODBNAME:
46: printf("No database name specified\n");
47: usage:
48: printf("usage: printadmin database\n");
49: exit(-1);
50: default:
51: syserr("initucode %d", i);
52: }
53:
54: if (Flagvect[0] != NULL)
55: {
56: printf("No flags are allowed for this command\n");
57: goto usage;
58: }
59:
60: if (Parmvect[1] != NULL)
61: goto usage;
62:
63: if (chdir(Dbpath) < 0)
64: syserr("cannot access database %s", db);
65: # ifdef xTTR2
66: if (tTf(1, 0))
67: printf("entered database %s\n", Dbpath);
68: # endif
69:
70: /* Admin struct has been filled in by initucode */
71: printf("Database %s, Dba %.2s, Adflags %o\n",
72: db, Admin.adhdr.adowner, Admin.adhdr.adflags);
73: printf("Code %d, adlen %d, adreldsz %d, adattdsz %d\n",
74: Admin.adhdr.adversion, Admin.adhdr.adlength,
75: Admin.adhdr.adreldsz, Admin.adhdr.adattdsz);
76:
77: printf("\n\n");
78: printdesc(&Admin.adreld);
79:
80: printf("\n\n");
81: printdesc(&Admin.adattd);
82: }
83:
84:
85: rubproc()
86: {
87: exit(1);
88: }
Defined functions
main
defined in line
10;
never used
Defined variables
Admin
defined in line
8; used 8 times
tTdbu
defined in line
7; used 1 times