Skip to content

Commit

Permalink
Merge pull request #908 from xexyl/e-option
Browse files Browse the repository at this point in the history
  • Loading branch information
lcn2 authored Jul 12, 2024
2 parents 2e0379a + 534c9bc commit f159dd4
Show file tree
Hide file tree
Showing 730 changed files with 787 additions and 752 deletions.
11 changes: 11 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
# Major changes to the IOCCC entry toolkit


## Release 1.2.3 2024-07-12

Add `-e` option to `mkiocccentry(1)` which if specified will be passed to
`txzchk(1)`. The test suite always uses this option. The man page for
`mkiocccentry(1)` was updated to show this new option. The guidelines might want
to be updated for this but they might not want to be. This is TBD later.

Updated `MKIOCCCENTRY_VERSION` to `"1.0.7 2024-07-12"` for the `-e` option.



## Release 1.2.2 2024-07-11

Removed `-q` from `txzchk(1)` and make it always show warnings. If one wants to
Expand Down
4 changes: 2 additions & 2 deletions jparse/test_jparse/test_JSON/good/party.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"alias" : "Precious",
"alias" : "Sméagol",
"alias" : "Dígol",
"RSVP_requested" : false,
"RSVP_requested" : true,
"attendance" : "denied",
"guest_number": -1,
"Gross" : false,
Expand All @@ -77,7 +77,7 @@
"RSVP_state" : "pending"
},
{
"name": "Sackville-Baggins",
"name": "Sackville-Bagginses",
"alias": "Spoons thieves",
"RSVP_requested" : false,
"attendance" : "tolerated",
Expand Down
56 changes: 37 additions & 19 deletions mkiocccentry.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ static const char * const usage_msg1 =
"\t-c cp\t\tpath to cp executable (def: %s)\n"
"\t-l ls\t\tpath to ls executable (def: %s)\n"
"\t-T txzchk\tpath to txzchk executable (def: %s)\n"
"\t-e\t\tentertainment mode\n"
"\t-F fnamchk\tpath to fnamchk executable used by txzchk (def: %s)";
static const char * const usage_msg2 =
"\t-C chkentry path to chkentry executable (def: %s)\n";
Expand Down Expand Up @@ -174,6 +175,7 @@ static bool ignore_warnings = false; /* true ==> ignore all warnings (this does
static FILE *input_stream = NULL; /* input file: stdin or answers file */
static unsigned answers_errors; /* > 0 ==> output errors on answers file */
static bool answer_yes = false; /* true ==> -y used: always answer yes (use with EXTREME caution!) */
static bool entertain = false; /* for -e mode for txzchk -e */

/*
* forward declarations
Expand Down Expand Up @@ -227,7 +229,7 @@ main(int argc, char *argv[])
*/
input_stream = stdin; /* default to reading from standard in */
program = argv[0];
while ((i = getopt(argc, argv, ":hv:J:qVt:c:l:a:i:A:WT:F:C:y")) != -1) {
while ((i = getopt(argc, argv, ":hv:J:qVt:c:l:a:i:A:WT:eF:C:y")) != -1) {
switch (i) {
case 'h': /* -h - print help to stderr and exit 2 */
usage(2, program, ""); /*ooo*/
Expand Down Expand Up @@ -295,6 +297,9 @@ main(int argc, char *argv[])
txzchk_flag_used = true;
txzchk = optarg;
break;
case 'e':
entertain = true;
break;
case 'F':
fnamchk_flag_used = true;
fnamchk = optarg;
Expand Down Expand Up @@ -5291,14 +5296,27 @@ form_tarball(char const *work_dir, char const *submission_dir, char const *tarba
/*
* perform the txzchk which will indirectly show the user the tarball contents
*/
dbg(DBG_HIGH, "about to perform: %s -w -v 1 -F %s -- %s/../%s",
txzchk, fnamchk, submission_dir, basename_tarball_path);
exit_code = shell_cmd(__func__, false, true, "% -w -v 1 -F % -- %/../%",
txzchk, fnamchk, submission_dir, basename_tarball_path);
if (exit_code != 0) {
err(183, __func__, "%s -w -v 1 -F %s -- %s/../%s failed with exit code: %d",
txzchk, fnamchk, submission_dir, basename_tarball_path, WEXITSTATUS(exit_code));
not_reached();
if (entertain) {
dbg(DBG_HIGH, "about to perform: %s -e -w -v 1 -F %s -- %s/../%s",
txzchk, fnamchk, submission_dir, basename_tarball_path);
exit_code = shell_cmd(__func__, false, true, "% -e -w -v 1 -F % -- %/../%",
txzchk, fnamchk, submission_dir, basename_tarball_path);
if (exit_code != 0) {
err(183, __func__, "%s -e -w -v 1 -F %s -- %s/../%s failed with exit code: %d",
txzchk, fnamchk, submission_dir, basename_tarball_path, WEXITSTATUS(exit_code));
not_reached();
}

} else {
dbg(DBG_HIGH, "about to perform: %s -w -v 1 -F %s -- %s/../%s",
txzchk, fnamchk, submission_dir, basename_tarball_path);
exit_code = shell_cmd(__func__, false, true, "% -w -v 1 -F % -- %/../%",
txzchk, fnamchk, submission_dir, basename_tarball_path);
if (exit_code != 0) {
err(184, __func__, "%s -w -v 1 -F %s -- %s/../%s failed with exit code: %d",
txzchk, fnamchk, submission_dir, basename_tarball_path, WEXITSTATUS(exit_code));
not_reached();
}
}
para("",
"... the output above is the listing of the compressed tarball.",
Expand Down Expand Up @@ -5344,13 +5362,13 @@ remind_user(char const *work_dir, char const *submission_dir, char const *tar, c
* firewall
*/
if (work_dir == NULL || submission_dir == NULL || tar == NULL || tarball_path == NULL) {
err(184, __func__, "called with NULL arg(s)");
err(185, __func__, "called with NULL arg(s)");
not_reached();
}

submission_dir_esc = cmdprintf("%", submission_dir);
if (submission_dir_esc == NULL) {
err(185, __func__, "failed to cmdprintf: submission_dir");
err(186, __func__, "failed to cmdprintf: submission_dir");
not_reached();
}

Expand All @@ -5363,14 +5381,14 @@ remind_user(char const *work_dir, char const *submission_dir, char const *tar, c
NULL);
ret = printf(" rm -rf %s%s\n", submission_dir[0] == '-' ? "-- " : "", submission_dir_esc);
if (ret <= 0) {
errp(186, __func__, "printf #0 error");
errp(187, __func__, "printf #0 error");
not_reached();
}
free(submission_dir_esc);

work_dir_esc = cmdprintf("%", work_dir);
if (work_dir_esc == NULL) {
err(187, __func__, "failed to cmdprintf: work_dir");
err(188, __func__, "failed to cmdprintf: work_dir");
not_reached();
}

Expand All @@ -5381,7 +5399,7 @@ remind_user(char const *work_dir, char const *submission_dir, char const *tar, c
NULL);
ret = printf(" %s -Jtvf %s%s/%s\n", tar, work_dir[0] == '-' ? "./" : "", work_dir_esc, tarball_path);
if (ret <= 0) {
errp(188, __func__, "printf #2 error");
errp(189, __func__, "printf #2 error");
not_reached();
}
free(work_dir_esc);
Expand Down Expand Up @@ -5444,7 +5462,7 @@ show_registration_url(void)
errno = 0; /* pre-clear errno for warnp() */
ret = fprintf(stderr, " %s\n", IOCCC_REGISTER_URL);
if (ret <= 0) {
err(189, __func__, "fprintf error printing IOCCC_REGISTER_URL");
err(190, __func__, "fprintf error printing IOCCC_REGISTER_URL");
not_reached();
}

Expand All @@ -5462,7 +5480,7 @@ show_registration_url(void)
errno = 0; /* pre-clear errno for warnp() */
ret = fprintf(stderr, " %s\n\n", IOCCC_NEWS_URL);
if (ret <= 0) {
err(190, __func__, "fprintf error printing IOCCC_NEWS_URL");
err(191, __func__, "fprintf error printing IOCCC_NEWS_URL");
not_reached();
}
para("",
Expand Down Expand Up @@ -5516,7 +5534,7 @@ show_submit_url(char const *work_dir, char const *tarball_path)
NULL);
ret = printf(" %s/%s\n", work_dir, tarball_path);
if (ret <= 0) {
errp(191, __func__, "printf #4 error");
errp(192, __func__, "printf #4 error");
not_reached();
}

Expand All @@ -5530,7 +5548,7 @@ show_submit_url(char const *work_dir, char const *tarball_path)
NULL);
ret = printf(" %s\n", IOCCC_SUBMIT_URL);
if (ret < 0) {
errp(192, __func__, "printf #5 error");
errp(193, __func__, "printf #5 error");
not_reached();
}

Expand All @@ -5547,7 +5565,7 @@ show_submit_url(char const *work_dir, char const *tarball_path)
errno = 0; /* pre-clear errno for warnp() */
ret = fprintf(stderr, " %s\n", IOCCC_NEWS_URL);
if (ret <= 0) {
err(193, __func__, "fprintf error printing IOCCC_NEWS_URL");
err(194, __func__, "fprintf error printing IOCCC_NEWS_URL");
not_reached();
}
para("",
Expand Down
8 changes: 7 additions & 1 deletion soup/man/man1/mkiocccentry.1
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
.\" "Share and Enjoy!"
.\" -- Sirius Cybernetics Corporation Complaints Division, JSON spec department. :-)
.\"
.TH mkiocccentry 1 "19 May 2024" "mkiocccentry" "IOCCC tools"
.TH mkiocccentry 1 "12 July 2024" "mkiocccentry" "IOCCC tools"
.SH NAME
.B mkiocccentry
\- make an IOCCC compressed tarball for an IOCCC entry
Expand Down Expand Up @@ -145,6 +145,12 @@ and
.I /usr/local/bin/txzchk
if this option is not specified.
.TP
.B \-e
Pass
.B \-e
to
.BR txzchk (1).
.TP
.BI \-F\ fnamchk
Set
.B fnamchk
Expand Down
2 changes: 1 addition & 1 deletion soup/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
/*
* official mkiocccentry version
*/
#define MKIOCCCENTRY_VERSION "1.0.6 2024-05-19" /* format: major.minor YYYY-MM-DD */
#define MKIOCCCENTRY_VERSION "1.0.7 2024-07-12" /* format: major.minor YYYY-MM-DD */

/*
* Version of info for JSON the .info.json file.
Expand Down
8 changes: 4 additions & 4 deletions test_ioccc/mkiocccentry_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export TOPDIR=

# parse args
#
while getopts :hv:J:Vt:T:l:c:F:Z: flag; do
while getopts :hv:J:Vt:T:el:c:F:Z: flag; do
case "$flag" in
h) echo "$USAGE" 1>&2
exit 2
Expand Down Expand Up @@ -362,7 +362,7 @@ find "${work_dir_esc}" -mindepth 1 -depth -delete
rm -f "${src_dir}"/empty.c
:> "${src_dir}"/empty.c
# test empty prog.c, ignoring the warning about it
./mkiocccentry -y -q -W -i answers.txt -F "$FNAMCHK" -t "$TAR" -T "$TXZCHK" -c "$CP" -l "$LS" -v "$V_FLAG" -J "$J_FLAG" -- "${work_dir}" "${src_dir}"/{empty.c,Makefile,remarks.md,extra1,extra2}
./mkiocccentry -y -q -W -i answers.txt -F "$FNAMCHK" -t "$TAR" -T "$TXZCHK" -e -c "$CP" -l "$LS" -v "$V_FLAG" -J "$J_FLAG" -- "${work_dir}" "${src_dir}"/{empty.c,Makefile,remarks.md,extra1,extra2}
status=$?
if [[ ${status} -ne 0 ]]; then
echo "$0: ERROR: mkiocccentry non-zero exit code: $status" 1>&2
Expand Down Expand Up @@ -458,7 +458,7 @@ answers >>answers.txt

# run the test, looking for an exit
#
./mkiocccentry -y -q -i answers.txt -F "$FNAMCHK" -t "$TAR" -T "$TXZCHK" -c "$CP" -l "$LS" -v "$V_FLAG" -J "$J_FLAG" -- "${work_dir}" "${src_dir}"/{prog.c,Makefile,remarks.md,extra1,extra2}
./mkiocccentry -y -q -i answers.txt -F "$FNAMCHK" -t "$TAR" -T "$TXZCHK" -e -c "$CP" -l "$LS" -v "$V_FLAG" -J "$J_FLAG" -- "${work_dir}" "${src_dir}"/{prog.c,Makefile,remarks.md,extra1,extra2}
status=$?
if [[ ${status} -ne 0 ]]; then
echo "$0: ERROR: mkiocccentry non-zero exit code: $status" 1>&2
Expand Down Expand Up @@ -542,7 +542,7 @@ test -f "${src_dir}"/bar || cat CODE_OF_CONDUCT.md >"${src_dir}"/bar

# run the test, looking for an exit
#
./mkiocccentry -y -q -i answers.txt -F "$FNAMCHK" -t "$TAR" -T "$TXZCHK" -c "$CP" -l "$LS" -v "$V_FLAG" -J "$J_FLAG" -- "${work_dir}" "${src_dir}"/{prog.c,Makefile,remarks.md,extra1,extra2,foo,bar}
./mkiocccentry -y -q -i answers.txt -F "$FNAMCHK" -t "$TAR" -T "$TXZCHK" -e -c "$CP" -l "$LS" -v "$V_FLAG" -J "$J_FLAG" -- "${work_dir}" "${src_dir}"/{prog.c,Makefile,remarks.md,extra1,extra2,foo,bar}
status=$?
if [[ ${status} -ne 0 ]]; then
echo "$0: ERROR: mkiocccentry non-zero exit code: $status" 1>&2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"IOCCC_auth_version" : "1.22 2024-05-18",
"IOCCC_contest" : "IOCCCMOCK",
"IOCCC_year" : 2023,
"mkiocccentry_version" : "1.0.6 2024-05-19",
"mkiocccentry_version" : "1.0.7 2024-07-12",
"chkentry_version" : "1.0.1 2024-03-02",
"fnamchk_version" : "1.0.2 2024-05-15",
"IOCCC_contest_id" : "12345678-1234-4321-abcd-1234567890ab",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"IOCCC_auth_version" : "x.yy yyyy-mm-dd",
"IOCCC_contest" : "IOCCCMOCK",
"IOCCC_year" : 2023,
"mkiocccentry_version" : "1.0.6 2024-05-19",
"mkiocccentry_version" : "1.0.7 2024-07-12",
"chkentry_version" : "1.0.1 2024-03-02",
"fnamchk_version" : "1.0.2 2024-05-15",
"IOCCC_contest_id" : "12345678-1234-4321-abcd-1234567890ab",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"IOCCC_auth_version" : null,
"IOCCC_contest" : "IOCCCMOCK",
"IOCCC_year" : 2023,
"mkiocccentry_version" : "1.0.6 2024-05-19",
"mkiocccentry_version" : "1.0.7 2024-07-12",
"chkentry_version" : "1.0.1 2024-03-02",
"fnamchk_version" : "1.0.2 2024-05-15",
"IOCCC_contest_id" : "12345678-1234-4321-abcd-1234567890ab",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"IOCCC_auth_version" : "1.22 2024-05-18",
"IOCCC_contest" : "IOCCCTEST",
"IOCCC_year" : 2023,
"mkiocccentry_version" : "1.0.6 2024-05-19",
"mkiocccentry_version" : "1.0.7 2024-07-12",
"chkentry_version" : "1.0.1 2024-03-02",
"fnamchk_version" : "1.0.2 2024-05-15",
"IOCCC_contest_id" : "12345678-1234-4321-abcd-1234567890ab",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"IOCCC_auth_version" : "1.22 2024-05-18",
"IOCCC_contest" : null,
"IOCCC_year" : 2023,
"mkiocccentry_version" : "1.0.6 2024-05-19",
"mkiocccentry_version" : "1.0.7 2024-07-12",
"chkentry_version" : "1.0.1 2024-03-02",
"fnamchk_version" : "1.0.2 2024-05-15",
"IOCCC_contest_id" : "12345678-1234-4321-abcd-1234567890ab",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"IOCCC_auth_version" : "1.22 2024-05-18",
"IOCCC_contest" : "IOCCCMOCK",
"IOCCC_year" : 2023,
"mkiocccentry_version" : "1.0.6 2024-05-19",
"mkiocccentry_version" : "1.0.7 2024-07-12",
"chkentry_version" : "1.0.1 2024-03-02",
"fnamchk_version" : "1.0.2 2024-05-15",
"IOCCC_contest_id" : "123456-1234-4321-abcd-1234567890",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"IOCCC_auth_version" : "1.22 2024-05-18",
"IOCCC_contest" : "IOCCCMOCK",
"IOCCC_year" : 2023,
"mkiocccentry_version" : "1.0.6 2024-05-19",
"mkiocccentry_version" : "1.0.7 2024-07-12",
"chkentry_version" : "1.0.1 2024-03-02",
"fnamchk_version" : "1.0.2 2024-05-15",
"IOCCC_contest_id" : null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"IOCCC_auth_version" : "1.22 2024-05-18",
"IOCCC_contest" : "IOCCCMOCK",
"IOCCC_year" : 12345,
"mkiocccentry_version" : "1.0.6 2024-05-19",
"mkiocccentry_version" : "1.0.7 2024-07-12",
"chkentry_version" : "1.0.1 2024-03-02",
"fnamchk_version" : "1.0.2 2024-05-15",
"IOCCC_contest_id" : "12345678-1234-4321-abcd-1234567890ab",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"IOCCC_auth_version" : "1.22 2024-05-18",
"IOCCC_contest" : "IOCCCMOCK",
"IOCCC_year" : null,
"mkiocccentry_version" : "1.0.6 2024-05-19",
"mkiocccentry_version" : "1.0.7 2024-07-12",
"chkentry_version" : "1.0.1 2024-03-02",
"fnamchk_version" : "1.0.2 2024-05-15",
"IOCCC_contest_id" : "12345678-1234-4321-abcd-1234567890ab",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"IOCCC_auth_version" : "1.22 2024-05-18",
"IOCCC_contest" : "IOCCCMOCK",
"IOCCC_year" : 2023,
"mkiocccentry_version" : "1.0.6 2024-05-19",
"mkiocccentry_version" : "1.0.7 2024-07-12",
"chkentry_version" : "1.0.1 2024-03-02",
"fnamchk_version" : "1.0.2 2024-05-15",
"IOCCC_contest_id" : "12345678-1234-4321-abcd-1234567890ab",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"IOCCC_auth_version" : "1.22 2024-05-18",
"IOCCC_contest" : "IOCCCMOCK",
"IOCCC_year" : 2023,
"mkiocccentry_version" : "1.0.6 2024-05-19",
"mkiocccentry_version" : "1.0.7 2024-07-12",
"chkentry_version" : "1.0.1 2024-03-02",
"fnamchk_version" : "1.0.2 2024-05-15",
"IOCCC_contest_id" : "12345678-1234-4321-abcd-1234567890ab",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"IOCCC_auth_version" : "1.22 2024-05-18",
"IOCCC_contest" : "IOCCCMOCK",
"IOCCC_year" : 2023,
"mkiocccentry_version" : "1.0.6 2024-05-19",
"mkiocccentry_version" : "1.0.7 2024-07-12",
"chkentry_version" : "1.0.1 2024-03-02",
"fnamchk_version" : "1.0.2 2024-05-15",
"IOCCC_contest_id" : "12345678-1234-4321-abcd-1234567890ab",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"IOCCC_auth_version" : "1.22 2024-05-18",
"IOCCC_contest" : "IOCCCMOCK",
"IOCCC_year" : 2023,
"mkiocccentry_version" : "1.0.6 2024-05-19",
"mkiocccentry_version" : "1.0.7 2024-07-12",
"chkentry_version" : "1.0.1 2024-03-02",
"fnamchk_version" : "1.0.2 2024-05-15",
"IOCCC_contest_id" : "12345678-1234-4321-abcd-1234567890ab",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"IOCCC_auth_version" : "1.22 2024-05-18",
"IOCCC_contest" : "IOCCCMOCK",
"IOCCC_year" : 2023,
"mkiocccentry_version" : "1.0.6 2024-05-19",
"mkiocccentry_version" : "1.0.7 2024-07-12",
"chkentry_version" : "1.0.1 2024-03-02",
"fnamchk_version" : "1.0.2 2024-05-15",
"IOCCC_contest_id" : "12345678-1234-4321-abcd-1234567890ab",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"IOCCC_auth_version" : "1.22 2024-05-18",
"IOCCC_contest" : "IOCCCMOCK",
"IOCCC_year" : 2023,
"mkiocccentry_version" : "1.0.6 2024-05-19",
"mkiocccentry_version" : "1.0.7 2024-07-12",
"chkentry_version" : "1.0.1 2024-03-02",
"fnamchk_version" : "1.0.2 2024-05-15",
"IOCCC_contest_id" : "12345678-1234-4321-abcd-1234567890ab",
Expand Down
Loading

0 comments on commit f159dd4

Please sign in to comment.