Skip to content

Commit 3776473

Browse files
committed
Fix and improve warning of -y and -Y
The code did not explicitly check for -Y; it just used the implicit -y from -Y. That is fixed and now if not -q show a simple summary but always show the longer warning to be sure that they know. As for -Y it really ought to be used only for the test script but even -y should be used with EXTREME caution. It is hoped this is the last update to mkiocccentry(1) prior to the soft code freeze today. TODO: finish work on the chkentry_test.sh script.
1 parent 1092520 commit 3776473

File tree

3 files changed

+53
-23
lines changed

3 files changed

+53
-23
lines changed

CHANGES.md

+17
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,23 @@
11
# Major changes to the IOCCC entry toolkit
22

33

4+
## Release 2.3.45 2025-02-28
5+
6+
Fix and improve warning of `-y` and `-Y` in `mkiocccentry`.
7+
8+
The code did not explicitly check for `-Y`; it just used the implicit `-y` from
9+
`-Y`. That is fixed and now if not `-q` show a simple summary but always show
10+
the longer warning to be sure that they know. As for `-Y` it really ought to be
11+
used only for the test script but even `-y` should be used with **EXTREME**
12+
caution.
13+
14+
It is hoped this is the last update to `mkiocccentry(1)` prior to the soft code
15+
freeze today.
16+
17+
TODO: finish work on the `chkentry_test.sh` script.
18+
19+
20+
421
## Release 2.3.44 2025-02-27
522

623
Prepare for code freeze (28 February 2025) with some final changes, some

mkiocccentry.c

+34-21
Original file line numberDiff line numberDiff line change
@@ -567,39 +567,52 @@ main(int argc, char *argv[])
567567
print("Welcome to mkiocccentry version: %s\n", MKIOCCCENTRY_VERSION);
568568
}
569569

570+
570571
/*
571-
* warn (if not -q/quiet mode) user that with -i answers (or -y) we will
572-
* always answer yes. This is especially important (in fact absolutely
573-
* essential for -i answers) because if there was a change in file set(s)
574-
* then the answers file would be entirely useless!
572+
* warn about -Y option
575573
*/
576-
if (answer_yes && !quiet) {
574+
if (force_yes) {
575+
para("",
576+
"WARNING: you've chosen to answer YES to ALL prompts. If this was",
577+
"unintentional, run the program again without specifying -Y. We cannot",
578+
"stress the importance of this enough! Well OK, we can overstress most things",
579+
"but you get the point; do not use the -Y option without EXTREME caution!",
580+
"",
581+
"Hint: this option is mostly useful for mkiocccentry_test.sh; if you REALLY",
582+
"want to answer yes you should use -y instead which will allow you to still",
583+
"verify certain things.",
584+
"",
585+
NULL);
586+
577587
/*
578-
* we could use msg() but this performs more checks which is very
579-
* important for this
588+
* if not quiet give a shorter warning as well
580589
*/
581-
print("%s", "Notice: we will always answer yes to questions.");
590+
if (!quiet) {
591+
print("%s", "Notice: we will ALWAYS answer YES to questions.\n");
592+
}
593+
} else if (answer_yes) {
594+
/* warn about -y option */
595+
para("",
596+
"WARNING: you've chosen to answer yes to ALMOST ALL prompts. If this was",
597+
"unintentional, run the program again without specifying -y. We cannot",
598+
"stress the importance of this enough! Well OK, we can overstress most things",
599+
"but you get the point; do not use the -y option without EXTREME caution!",
600+
"",
601+
NULL);
602+
/*
603+
* if not quiet give a shorter warning as well
604+
*/
605+
if (!quiet) {
606+
print("%s", "Notice: we will answer YES to MOST questions.\n");
607+
}
582608
}
583609

584610

585-
586611
/*
587612
* save our version
588613
*/
589614
info.mkiocccentry_ver = MKIOCCCENTRY_VERSION;
590615
dbg(DBG_HIGH, "info.mkiocccentry_ver: %s", info.mkiocccentry_ver);
591-
592-
/* warn about -y option */
593-
if (answer_yes) {
594-
para("",
595-
"WARNING: you've chosen to answer yes to almost all prompts. If this was",
596-
"unintentional, run the program again without specifying -y. We cannot",
597-
"stress the importance of this enough! Well OK, we can overstress most things",
598-
"but you get the point; do not use the -y option without EXTREME caution!",
599-
"",
600-
NULL);
601-
}
602-
603616
/* if the user requested to ignore warnings, and now -E, then ignore this once and warn them :) */
604617
if (ignore_warnings) {
605618
para("",

soup/version.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383
*
8484
* NOTE: This should match the latest Release string in CHANGES.md
8585
*/
86-
#define MKIOCCCENTRY_REPO_VERSION "2.3.45 2025-02-27" /* special release format: major.minor[.patch] YYYY-MM-DD */
86+
#define MKIOCCCENTRY_REPO_VERSION "2.3.46 2025-02-28" /* special release format: major.minor[.patch] YYYY-MM-DD */
8787

8888

8989
/*
@@ -99,7 +99,7 @@
9999
/*
100100
* official mkiocccentry versions (mkiocccentry itself and answers)
101101
*/
102-
#define MKIOCCCENTRY_VERSION "1.2.35 2025-02-27" /* format: major.minor YYYY-MM-DD */
102+
#define MKIOCCCENTRY_VERSION "1.2.36 2025-02-28" /* format: major.minor YYYY-MM-DD */
103103
#define MKIOCCCENTRY_ANSWERS_VERSION "MKIOCCCENTRY_ANSWERS_IOCCC28-1.0" /* answers file version */
104104
#define MKIOCCCENTRY_ANSWERS_EOF "ANSWERS_EOF" /* answers file EOF marker */
105105

0 commit comments

Comments
 (0)