Change __signed to signed.
[dragonfly.git] / crypto / kerberosIV / admin / kdb_destroy.c
1 /*
2  * Copyright 1988 by the Massachusetts Institute of Technology.
3  *
4  * For copying and distribution information, please see the file
5  * <mit-copyright.h>.
6  *
7  * Description.
8  */
9
10 #include "adm_locl.h"
11
12 RCSID("$Id: kdb_destroy.c,v 1.9 1998/06/09 19:24:13 joda Exp $");
13
14 int
15 main(int argc, char **argv)
16 {
17     char    answer[10];         /* user input */
18 #ifdef HAVE_NEW_DB
19     char   *file;               /* database file names */
20 #else
21     char   *file1, *file2;      /* database file names */
22 #endif
23
24     set_progname (argv[0]);
25
26 #ifdef HAVE_NEW_DB
27     asprintf(&file, "%s.db", DBM_FILE);
28     if (file == NULL)
29         err (1, "malloc");
30 #else
31     asprintf(&file1, "%s.dir", DBM_FILE);
32     asprintf(&file2, "%s.pag", DBM_FILE);
33     if (file1 == NULL || file2 == NULL)
34         err (1, "malloc");
35 #endif
36
37     printf("You are about to destroy the Kerberos database ");
38     printf("on this machine.\n");
39     printf("Are you sure you want to do this (y/n)? ");
40     if (fgets(answer, sizeof(answer), stdin) != NULL
41         && (answer[0] == 'y' || answer[0] == 'Y')) {
42 #ifdef HAVE_NEW_DB
43       if (unlink(file) == 0)
44 #else
45         if (unlink(file1) == 0 && unlink(file2) == 0)
46 #endif
47           {
48             warnx ("Database deleted at %s", DBM_FILE);
49             return 0;
50           }
51         else
52             warn ("Database cannot be deleted at %s", DBM_FILE);
53     } else
54         warnx ("Database not deleted at %s", DBM_FILE);
55     return 1;
56 }