diff --git a/man/files.1 b/man/files.1 index 5dda7631..4fafc128 100644 --- a/man/files.1 +++ b/man/files.1 @@ -7,6 +7,9 @@ files \- Empire file initialization [ .BI \-e\ configfile ] +[ +.BI \-f +] .br .SH DESCRIPTION .I files @@ -22,3 +25,6 @@ causes to use the game configuration specified in .I configfile (by default, the file "econfig" in the data directory is used) +.TP +.BI \-f +Clobber existing game data without asking for confirmation. diff --git a/src/util/files.c b/src/util/files.c index 738a5b40..a670c912 100644 --- a/src/util/files.c +++ b/src/util/files.c @@ -82,13 +82,17 @@ main(int argc, char *argv[]) extern char *optarg; int opt; char *config_file = NULL; - + int force = 0; + #if !defined(_WIN32) - while ((opt = getopt(argc, argv, "e:")) != EOF) { + while ((opt = getopt(argc, argv, "e:f")) != EOF) { switch (opt) { case 'e': config_file = optarg; break; + case 'f': + force = 1; + break; } } #endif @@ -111,12 +115,14 @@ main(int argc, char *argv[]) printf("Can't make game directory\n"); exit(1); } - printf("WARNING: this blasts the existing game in %s (if any)\n", + if (!force) { + printf("WARNING: this blasts the existing game in %s (if any)\n", datadir); - printf("continue? "); - fgets(buf, sizeof(buf) - 1, stdin); - if (*buf != 'y' && *buf != 'Y') - exit(1); + printf("continue? "); + fgets(buf, sizeof(buf) - 1, stdin); + if (*buf != 'y' && *buf != 'Y') + exit(1); + } for (i = 0; i < EF_MAX; i++) { if (ef_open(i, O_RDWR | O_CREAT | O_TRUNC, 0) < 0) { perror("ef_open");