From 6638b9cea78fdd7277b768ea6611681a7f8e6fed Mon Sep 17 00:00:00 2001 From: Kenny Root Date: Mon, 15 Jun 2026 22:05:17 -0700 Subject: [PATCH 1/3] chore: package releases for fork This will help users reporting bugs and identifying which version they are running on their local system. --- .github/workflows/packages.yml | 69 ++++++++++++++++++++++++++++++++ CMakeLists.txt | 40 +++++++++++++++++- packaging/make-source-archive.sh | 19 ++++++++- src/command.c | 1 + src/globals.c | 2 + src/globals.h | 1 + src/main.c | 8 ++++ src/signals.c | 1 + src/tf.h | 2 +- src/tfdefs.h.in | 2 + src/tfio.c | 6 +-- src/varlist.h | 1 + 12 files changed, 146 insertions(+), 6 deletions(-) diff --git a/.github/workflows/packages.yml b/.github/workflows/packages.yml index 225def5..a91f66d 100644 --- a/.github/workflows/packages.yml +++ b/.github/workflows/packages.yml @@ -246,3 +246,72 @@ jobs: with: name: cygwin-packages path: artifacts/cygwin/ + + release: + name: GitHub Release + needs: [debian, rpm, homebrew, freebsd, cygwin] + if: startsWith(github.ref, 'refs/tags/v') + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - name: Checkout source + uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 + with: + fetch-depth: 0 + + - name: Download Debian packages + uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372ec806872 # v4 + with: + name: debian-packages + path: release-artifacts + + - name: Download RPM packages + uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372ec806872 # v4 + with: + name: rpm-packages + path: release-artifacts + + - name: Download Homebrew bottle + uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372ec806872 # v4 + with: + name: homebrew-bottle + path: release-artifacts + + - name: Download FreeBSD package + uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372ec806872 # v4 + with: + name: freebsd-package + path: release-artifacts + + - name: Download Cygwin packages + uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372ec806872 # v4 + with: + name: cygwin-packages + path: release-artifacts + + - name: Generate release version and source archive + id: release_info + run: | + # Determine the fork version name + TAG_NAME="${{ github.ref_name }}" + FORK_VERSION="kruton-${TAG_NAME#v}" + echo "fork_version=${FORK_VERSION}" >> "$GITHUB_OUTPUT" + + # Generate source tarball containing fork_version.txt + chmod +x packaging/make-source-archive.sh + packaging/make-source-archive.sh \ + --prefix "tinyfugue-${FORK_VERSION}" \ + "release-artifacts/tinyfugue-${FORK_VERSION}.tar.gz" + + - name: Create Release + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + # Find all files to upload + files=$(find release-artifacts -type f) + gh release create "${{ github.ref_name }}" \ + --title "${{ steps.release_info.outputs.fork_version }}" \ + --notes "Automated release of TinyFugue fork version ${{ steps.release_info.outputs.fork_version }}" \ + $files diff --git a/CMakeLists.txt b/CMakeLists.txt index 1e41683..ebbdb06 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,6 +5,44 @@ project(tinyfugue VERSION 5.0.8 LANGUAGES C) set(TF_VERSION_SHORT "50b8") set(TF_VERSION_STRING "TinyFugue version 5.0 beta 8") +# Custom Release Versioning System +set(TF_FORK_VERSION_DEFAULT "") +if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/fork_version.txt") + file(READ "${CMAKE_CURRENT_SOURCE_DIR}/fork_version.txt" TF_FORK_VERSION_DEFAULT) + string(STRIP "${TF_FORK_VERSION_DEFAULT}" TF_FORK_VERSION_DEFAULT) +else() + find_package(Git QUIET) + if(GIT_FOUND AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git") + execute_process( + COMMAND ${GIT_EXECUTABLE} describe --tags --exact-match --match "v*" + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + OUTPUT_VARIABLE GIT_TAG + OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_QUIET + ) + if(GIT_TAG MATCHES "^v") + string(REGEX REPLACE "^v" "kruton-" TF_FORK_VERSION_DEFAULT "${GIT_TAG}") + else() + execute_process( + COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + OUTPUT_VARIABLE GIT_COMMIT_HASH + OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_QUIET + ) + if(GIT_COMMIT_HASH) + set(TF_FORK_VERSION_DEFAULT "kruton-dev-g${GIT_COMMIT_HASH}") + endif() + endif() + endif() +endif() + +if(NOT TF_FORK_VERSION_DEFAULT) + set(TF_FORK_VERSION_DEFAULT "kruton-dev") +endif() + +set(TF_FORK_VERSION "${TF_FORK_VERSION_DEFAULT}" CACHE STRING "Fork release version") + list(PREPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules") include(GNUInstallDirs) @@ -100,7 +138,7 @@ if(TF_EXTRA_LIBRARY_DIRS) list(APPEND CMAKE_REQUIRED_LINK_DIRECTORIES ${TF_EXTRA_LIBRARY_DIRS}) endif() -message(STATUS "Configuring ${TF_VERSION_STRING}") +message(STATUS "Configuring ${TF_VERSION_STRING} (Fork: ${TF_FORK_VERSION})") if(TF_CORE) set(DISABLE_CORE 0) diff --git a/packaging/make-source-archive.sh b/packaging/make-source-archive.sh index b186fd6..2a4f28c 100755 --- a/packaging/make-source-archive.sh +++ b/packaging/make-source-archive.sh @@ -45,7 +45,8 @@ esac mkdir -p "$(dirname "$output")" tmp="${output}.tmp.$$" tmp_tar="${output}.tar.tmp.$$" -trap 'rm -f "$tmp" "$tmp_tar"' EXIT HUP INT TERM +tmp_dir= +trap 'rm -f "$tmp" "$tmp_tar"; if [ -n "$tmp_dir" ]; then rm -rf "$tmp_dir"; fi' EXIT HUP INT TERM if $exclude_debian; then git -c "safe.directory=$repo" -C "$repo" archive \ @@ -56,6 +57,22 @@ else --format=tar --prefix="${prefix}/" \ --output="$tmp_tar" HEAD fi + +# Determine the fork version to write +if git -c "safe.directory=$repo" -C "$repo" describe --tags --exact-match --match "v*" >/dev/null 2>&1; then + GIT_TAG=$(git -c "safe.directory=$repo" -C "$repo" describe --tags --exact-match --match "v*") + FORK_VERSION="kruton-${GIT_TAG#v}" +else + GIT_COMMIT_HASH=$(git -c "safe.directory=$repo" -C "$repo" rev-parse --short HEAD) + FORK_VERSION="kruton-dev-g${GIT_COMMIT_HASH}" +fi + +# Append fork_version.txt to the tarball under the prefix directory +tmp_dir=$(mktemp -d "${TMPDIR:-/tmp}/tinyfugue-archive.XXXXXX") +mkdir -p "${tmp_dir}/${prefix}" +echo "${FORK_VERSION}" > "${tmp_dir}/${prefix}/fork_version.txt" +tar -C "$tmp_dir" -rf "$tmp_tar" "${prefix}/fork_version.txt" + gzip -n <"$tmp_tar" >"$tmp" mv "$tmp" "$output" rm -f "$tmp_tar" diff --git a/src/command.c b/src/command.c index 10e9e7e..eac9c29 100644 --- a/src/command.c +++ b/src/command.c @@ -273,6 +273,7 @@ struct Value *handle_version_command(String *args, int offset) { oprintf("%% %s.", version); oprintf("%% %s.", copyright); + if (*fork_version) oprintf("%% Fork version: %s.", fork_version); if (*contrib) oprintf("%% %s", contrib); if (*mods) oprintf("%% %s", mods); if (*sysname) oprintf("%% Built for %s", sysname); diff --git a/src/globals.c b/src/globals.c index 8fa928a..cf730f1 100644 --- a/src/globals.c +++ b/src/globals.c @@ -22,6 +22,8 @@ const char version[] = #endif TF_VERSION_STRING; +const char fork_version[] = TF_FORK_VERSION; + const char mods[] = ""; const char copyright[] = diff --git a/src/globals.h b/src/globals.h index 331fd68..312578d 100644 --- a/src/globals.h +++ b/src/globals.h @@ -156,6 +156,7 @@ enum Vars { #define TFLIBDIR getstdvar(VAR_TFLIBDIR) #define TFPATH getstdvar(VAR_TFPATH) #define TFMAILPATH getstdvar(VAR_TFMAILPATH) +#define TF_FORK_VERSION_VAR getstdvar(VAR_TF_FORK_VERSION) #define alert_attr getattrvar(VAR_alert_attr) #define alert_time gettimevar(VAR_alert_time) #define ansi_log getintvar(VAR_ansi_log) diff --git a/src/main.c b/src/main.c index 313993b..6b9764c 100644 --- a/src/main.c +++ b/src/main.c @@ -51,6 +51,9 @@ int main(int argc, char *argv[]) puts(""); puts(version); + if (*fork_version) { + printf("Fork version: %s\n", fork_version); + } puts(copyright); while (--argc > 0 && (*++argv)[0] == '-') { @@ -129,6 +132,11 @@ int main(int argc, char *argv[]) init_keyboard(); /* keyboard.c */ oputs(version); + if (*fork_version) { + char buf[128]; + snprintf(buf, sizeof(buf), "Fork version: %s", fork_version); + oputs(buf); + } oputs(copyright); oputs("Type `/help copyright' for more information."); if (*contrib) oputs(contrib); diff --git a/src/signals.c b/src/signals.c index b33a60a..e230ec0 100644 --- a/src/signals.c +++ b/src/signals.c @@ -412,6 +412,7 @@ static void coremsg(FILE *dumpfile) fputs("Also describe what you were doing in tf when this\r\n", stderr); fputs("occurred, and whether you can repeat it.\r\n\n", stderr); fprintf(dumpfile, "> %.512s\r\n", version); + if (*fork_version) fprintf(dumpfile, "> fork_version=%.256s\r\n", fork_version); if (*sysname) fprintf(dumpfile, "> %.256s\r\n", sysname); fprintf(dumpfile, "> %.256s\r\n", featurestr->data); fprintf(dumpfile,"> virtscreen=%ld, visual=%ld, expnonvis=%ld, " diff --git a/src/tf.h b/src/tf.h index 8befd96..4b3c034 100644 --- a/src/tf.h +++ b/src/tf.h @@ -183,7 +183,7 @@ VEC_TYPEDEF(hookvec_t, NUM_HOOKS); /* externs */ -extern const char version[], sysname[], copyright[], contrib[], mods[]; +extern const char version[], sysname[], copyright[], contrib[], mods[], fork_version[]; extern int restriction, debug; extern void internal_error(const char *file, int line, const char *fmt, ...) format_printf(3, 4); diff --git a/src/tfdefs.h.in b/src/tfdefs.h.in index 280ccf7..6eb6e7e 100644 --- a/src/tfdefs.h.in +++ b/src/tfdefs.h.in @@ -8,4 +8,6 @@ #define UNAME "@UNAME@" #define TF_VERSION_STRING "@TF_VERSION_STRING@" +#define TF_FORK_VERSION "@TF_FORK_VERSION@" +#define DEFAULT_TF_FORK_VERSION "@TF_FORK_VERSION@" #define DEFAULT_TFLIBD "@CMAKE_INSTALL_FULL_DATAROOTDIR@/@LIBNAME@" diff --git a/src/tfio.c b/src/tfio.c index fbcd899..735dfdb 100644 --- a/src/tfio.c +++ b/src/tfio.c @@ -756,7 +756,7 @@ void internal_error(const char *file, int line, const char *fmt, ...) { va_list ap; - eprintf("Internal error at %s:%d, %s. %s", file, line, version, interrmsg); + eprintf("Internal error at %s:%d, %s (fork %s). %s", file, line, version, fork_version, interrmsg); if (current_command) eprintf("cmd: \"%.32b\"", '\"', current_command); va_start(ap, fmt); @@ -769,8 +769,8 @@ void internal_error2(const char *file, int line, const char *file2, int line2, { va_list ap; - eprintf("Internal error at %s:%d (%s:%d), %s. %s", - file, line, file2, line2, version, interrmsg); + eprintf("Internal error at %s:%d (%s:%d), %s (fork %s). %s", + file, line, file2, line2, version, fork_version, interrmsg); if (current_command) eprintf("cmd: \"%.32b\"", '\"', current_command); va_start(ap, fmt); diff --git a/src/varlist.h b/src/varlist.h index 6b6ffbe..0733948 100644 --- a/src/varlist.h +++ b/src/varlist.h @@ -44,6 +44,7 @@ varstr (VAR_TERM, "TERM", NULL, change_term) varstr (VAR_TFLIBDIR, "TFLIBDIR", DEFAULT_TFLIBD, NULL) varstr (VAR_TFMAILPATH, "TFMAILPATH", NULL, ch_mailfile) varstr (VAR_TFPATH, "TFPATH", NULL, NULL) +varstr (VAR_TF_FORK_VERSION,"TF_FORK_VERSION",DEFAULT_TF_FORK_VERSION,NULL) varstrx(VAR_TZ, "TZ", NULL, ch_timezone) varstr (VAR_alert_attr, "alert_attr", "Br", ch_attr) vartime(VAR_alert_time, "alert_time", 5,0, NULL) From 519534ab4bc47c220f98c297212d57ef8a200516 Mon Sep 17 00:00:00 2001 From: Kenny Root Date: Tue, 16 Jun 2026 11:07:47 -0700 Subject: [PATCH 2/3] fix: change define to initialize fully --- src/command.c | 2 +- src/variable.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/command.c b/src/command.c index eac9c29..6526f9a 100644 --- a/src/command.c +++ b/src/command.c @@ -40,7 +40,7 @@ static void split_args(char *args); static BuiltinCmd cmd_table[] = { #define defcmd(name, func, reserved) \ - { name, func, reserved }, + { name, func, reserved, NULL }, #include "cmdlist.h" }; diff --git a/src/variable.c b/src/variable.c index f142b94..1dbb0b9 100644 --- a/src/variable.c +++ b/src/variable.c @@ -97,10 +97,10 @@ extern char **environ; /* Special variables. */ Var special_var[] = { #define varcode(id, name, sval, type, flags, enums, ival, uval, func) \ - {{ name, type, 1, NULL }, flags|VARSPECIAL, enums, func, NULL, 0 }, + {{ name, type, 1, NULL, {0} }, flags|VARSPECIAL, enums, func, NULL, 0, 0, 0 }, #include "varlist.h" #undef varcode - {{ NULL, 0, 1, NULL }, 0, NULL, NULL, NULL, 0 } + {{ NULL, 0, 1, NULL, {0} }, 0, NULL, NULL, NULL, 0, 0, 0 } }; Pattern looks_like_special_sub; /* looks like a special substitution */ From 51dd69f1029aff7ce3a2e4a50fbeb78374645cbf Mon Sep 17 00:00:00 2001 From: Kenny Root Date: Tue, 16 Jun 2026 11:19:24 -0700 Subject: [PATCH 3/3] fix: remaining warning elimination --- src/command.c | 8 ++++++++ src/dstring.c | 7 ++++++- src/expand.c | 2 +- src/expr.c | 2 +- src/macro.c | 3 ++- src/malloc.c | 5 +++++ src/output.c | 21 +++++++++++++-------- src/pattern.c | 5 +++++ src/process.c | 1 + src/signals.c | 3 +-- src/socket.c | 11 +++++++++-- src/tfio.c | 4 +++- src/util.c | 4 ++++ src/world.c | 1 + tests/test_main.c | 7 ++++++- 15 files changed, 66 insertions(+), 18 deletions(-) diff --git a/src/command.c b/src/command.c index 6526f9a..6aaf9f6 100644 --- a/src/command.c +++ b/src/command.c @@ -266,11 +266,15 @@ struct Value *handle_sh_command(String *args, int offset) struct Value *handle_suspend_command(String *args, int offset) { + (void)args; + (void)offset; return newint(suspend()); } struct Value *handle_version_command(String *args, int offset) { + (void)args; + (void)offset; oprintf("%% %s.", version); oprintf("%% %s.", copyright); if (*fork_version) oprintf("%% Fork version: %s.", fork_version); @@ -459,6 +463,8 @@ struct Value *handle_relimit_command(String *args, int offset) Screen *screen = display_screen; Value *result = val_one; + (void)args; + (void)offset; if (!enable_screen_filter(screen)) { alert(limit_none); result = val_zero; @@ -474,6 +480,8 @@ struct Value *handle_unlimit_command(String *args, int offset) { Screen *screen = display_screen; + (void)args; + (void)offset; if (!screen_has_filter(screen)) return shareval(val_zero); clear_screen_filter(screen); diff --git a/src/dstring.c b/src/dstring.c index bcf7d3e..79ca9b5 100644 --- a/src/dstring.c +++ b/src/dstring.c @@ -113,6 +113,9 @@ String *dSinit( const char *file, int line) { +#if !USE_MMALLOC + (void)md; +#endif if (data && len < 0) len = strlen(data); if (!str) { @@ -123,7 +126,9 @@ String *dSinit( if (!md || !str) #endif { +#if USE_MMALLOC md = NULL; +#endif str = xmalloc(NULL, sizeof(*str) + len + 1, file, line); } str->data = (char*)str + sizeof(*str); @@ -236,7 +241,7 @@ String *dSnadd(String *str, int c, int n, const char *file, int line) String *dStrunc(String *str, int len, const char *file, int line) { /* if (str->size && str->len < len) return str; */ - unsigned int oldlen = str->len; + int oldlen = str->len; str->len = len; lcheck(str, file, line); if (len <= oldlen) { diff --git a/src/expand.c b/src/expand.c index e326c28..afa86fa 100644 --- a/src/expand.c +++ b/src/expand.c @@ -769,7 +769,7 @@ Value *prog_interpret(const Program *prog, int in_expr) constr = blankline; if (patmatch(&looks_like_special_sub_ic, NULL, val->name)) { char upper[64]; - int i; + size_t i; for (i = 0; i < sizeof(upper) && val->name[i]; i++) upper[i] = ucase(val->name[i]); tfwprintf("\"%%{%s}\" is a variable substitution, " diff --git a/src/expr.c b/src/expr.c index fcbeb8f..dc28c86 100644 --- a/src/expr.c +++ b/src/expr.c @@ -59,7 +59,7 @@ static Value *valpool = NULL; /* freelist */ typedef struct ExprFunc { const char *name; /* name invoked by user */ - unsigned min, max; /* allowable argument counts */ + int min, max; /* allowable argument counts */ } ExprFunc; static ExprFunc functab[] = { diff --git a/src/macro.c b/src/macro.c index 1e9d444..2d0e85f 100644 --- a/src/macro.c +++ b/src/macro.c @@ -532,7 +532,8 @@ static int macro_match(Macro *spec, Macro *macro, AuxPat *aux) /* -h0 */ if (macro->flags & MACRO_HOOK) return 0; } else if (spec->flags & MACRO_HOOK) { - int i, hit = 0; + size_t i; + int hit = 0; if (!(macro->flags & MACRO_HOOK)) return 0; for (i = 0; i < sizeof(spec->hook)/sizeof(long); i++) { if ((hit = (spec->hook.bits[i] & macro->hook.bits[i]))) diff --git a/src/malloc.c b/src/malloc.c index b4159f8..8522dd1 100644 --- a/src/malloc.c +++ b/src/malloc.c @@ -24,6 +24,7 @@ void *xmalloc(void *md, long unsigned size, const char *file, const int line) { void *memory; + (void)md; if ((long)size <= 0) core("xmalloc(%ld).", file, line, (long)size); @@ -47,6 +48,7 @@ void *xrealloc(void *md, void *ptr, long unsigned size, { void *memory; + (void)md; if ((long)size <= 0) core("xrealloc(%ld).", file, line, (long)size); @@ -76,6 +78,9 @@ void *xcalloc(void *md, long unsigned size, const char *file, const int line) void xfree(void *md, void *ptr, const char *file, const int line) { + (void)md; + (void)file; + (void)line; dfree(md, ptr, file, line); if (!reserve) init_malloc(); diff --git a/src/output.c b/src/output.c index dc077c5..bbe72ee 100644 --- a/src/output.c +++ b/src/output.c @@ -208,7 +208,7 @@ void (*tp)(const char *str); String status_line[][1] = { /* formatted status lines, without alert */ STATIC_BUFFER_INIT, STATIC_BUFFER_INIT, STATIC_BUFFER_INIT, STATIC_BUFFER_INIT, STATIC_BUFFER_INIT, STATIC_BUFFER_INIT }; -#define max_status_height (sizeof(status_line)/sizeof(String)) +#define max_status_height ((int)(sizeof(status_line)/sizeof(String))) static StatusField *variable_width_field[max_status_height]; STATIC_BUFFER(outbuf); /* output buffer */ @@ -317,7 +317,7 @@ static Keycode keycodes[] = { /* this list is sorted by tolower(name)! */ { "Up", "ku", KEYCODE( "\033OA", "\033[A", "\033[A" ) } }; -#define N_KEYCODES (sizeof(keycodes)/sizeof(Keycode)) +#define N_KEYCODES ((int)(sizeof(keycodes)/sizeof(Keycode))) int lines = DEFAULT_LINES; int columns = DEFAULT_COLUMNS; @@ -374,6 +374,7 @@ void dobell(int n) int change_term(Var *var) { + (void)var; fix_screen(); init_term(); redraw(); @@ -1331,7 +1332,7 @@ conString *status_field_text(int row) Stringcat(buf, f->var->val.name); } else if (f->name) { Sappendf(buf, "\"%q\"", '"', f->name); - if (width == strlen(f->name)) width = 0; + if (width == (int)strlen(f->name)) width = 0; } if (!width && !f->attrs && !f->rightjust) continue; @@ -1614,6 +1615,7 @@ struct Value *handle_status_add_command(String *args, int offset) int ch_status_fields(Var *var) { + (void)var; if (warn_status) { tfwprintf("setting status_fields directly is deprecated, " "and may clobber useful new features introduced in version 5. " @@ -1942,13 +1944,12 @@ void format_status_line(void) { ListEntry *node; StatusField *field; - int row, column, width; + int row, column; for (row = 0; row < status_height; row++) { Stringtrunc(status_line[row], 0); column = 0; - width = 0; for (node = statusfield_list[row]->head; node; node = node->next) { field = (StatusField *)node->datum; @@ -1962,7 +1963,7 @@ void format_status_line(void) column - current_col, status_attr); } - width = format_statusfield(field, status_line[row]); + format_statusfield(field, status_line[row]); } int current_col = tf_string_width(status_line[row]->data, @@ -1991,6 +1992,7 @@ int display_status_line(void) int update_status_line(Var *var) { + (void)var; /* XXX optimization: some code that calls update_status_line() without * any change in status_line could call display_status_line() directly, * avoiding reformatting (in particular, status_{int,var}_* execution). */ @@ -2134,6 +2136,7 @@ int ch_status_height(Var *var) int ch_expnonvis(Var *var) { + (void)var; if (!can_have_expnonvis && expnonvis) { eprintf("expnonvis mode is not supported on this terminal."); return 0; @@ -2148,6 +2151,7 @@ int ch_expnonvis(Var *var) /* used by %{wrap}, %{wrappunct}, %{wrapsize}, %{wrapspace} */ int ch_wrap(Var *var) { + (void)var; if (screen_mode < 0) /* e.g., called by init_variables() */ return 1; @@ -2336,8 +2340,6 @@ static int ioutputs(const char *str, int len) */ static void ioutall(int kpos) { - int ppos; - if (kpos < 0) { /* posible only if there's a prompt */ #if WIDECHAR int prompt_rows = 0, prompt_column = 0; @@ -2352,6 +2354,7 @@ static void ioutall(int kpos) hwrite(prompt, start_offset, prompt->len - start_offset, 0); iendx = prompt_column + 1; #else + int ppos; kpos = -(-kpos % Wrap); ppos = prompt->len + kpos; if (ppos < 0) ppos = 0; @@ -3233,6 +3236,7 @@ int clear_more(int new) int tog_more(Var *var) { + (void)var; if (!more) clear_more(display_screen->outcount); else reset_outcount(display_screen); return 1; @@ -3240,6 +3244,7 @@ int tog_more(Var *var) int tog_keypad(Var *var) { + (void)var; if (!keypad_on) { if (keypad) eprintf("don't know how to enable keypad on %s terminal", TERM); diff --git a/src/pattern.c b/src/pattern.c index 93d90e3..e8f399b 100644 --- a/src/pattern.c +++ b/src/pattern.c @@ -83,6 +83,7 @@ RegInfo *new_reg_scope(RegInfo *ri, String *Str) { RegInfo *old; + (void)Str; old = reginfo; reginfo = ri ? ri : reginfo; /* use new ri or inherit old reginfo */ if (reginfo) reginfo->links++; @@ -133,6 +134,10 @@ static RegInfo *tf_reg_compile_fl(const char *pattern, int optimize, { RegInfo *ri; const char *s; + + (void)optimize; + (void)file; + (void)line; uint32_t options = PCRE2_DOLLAR_ENDONLY | PCRE2_DOTALL | PCRE2_CASELESS; #if WIDECHAR options |= PCRE2_UTF | PCRE2_UCP; diff --git a/src/process.c b/src/process.c index 31ebded..b04da3a 100644 --- a/src/process.c +++ b/src/process.c @@ -353,6 +353,7 @@ struct Value *handle_kill_command(String *args, int offset) int ch_lpquote(Var *var) { + (void)var; runall(lpquote, NULL); return 1; } diff --git a/src/signals.c b/src/signals.c index e230ec0..da011cc 100644 --- a/src/signals.c +++ b/src/signals.c @@ -554,9 +554,8 @@ static int debugger_dump(void) fprintf(stderr, "fork: %s\r\n", strerror(errno)); } else if (child_pid > 0) { /* parent */ - pid_t wait_pid = 0; int status = 0; - wait_pid = waitpid(child_pid, &status, 0); + waitpid(child_pid, &status, 0); if (shell_status(status) == 0) { return 1; } else { diff --git a/src/socket.c b/src/socket.c index 39bba0a..7590a21 100644 --- a/src/socket.c +++ b/src/socket.c @@ -408,7 +408,7 @@ static fd_set readers; /* input file descriptors */ static fd_set active; /* active file descriptors */ static fd_set writers; /* pending connections */ static fd_set connected; /* completed connections */ -static unsigned int nfds; /* max # of readers/writers */ +static int nfds; /* max # of readers/writers */ static Sock *hsock = NULL; /* head of socket list */ static Sock *tsock = NULL; /* tail of socket list */ static Sock *fsock = NULL; /* foreground socket */ @@ -986,6 +986,7 @@ void readers_set(int fd) int tog_bg(Var *var) { Sock *sock; + (void)var; if (background) for (sock = hsock; sock; sock = sock->next) if (sock->constate == SS_CONNECTED) @@ -998,6 +999,8 @@ int tog_keepalive(Var *var) Sock *sock; int flags; + (void)var; + flags = keepalive; for (sock = hsock; sock; sock = sock->next) { if (sock->constate != SS_CONNECTED) continue; @@ -1866,6 +1869,8 @@ static int nonblocking_gethost(const char *name, const char *port, int fds[2]; int err; + (void)res; + *what = "pipe"; if (pipe(fds) < 0) return -1; @@ -2710,7 +2715,7 @@ int send_line(const char *src, unsigned int len, int eol_flag) /* Buf1 -> Buf2 [Telnet escape] */ i = 0; j = 0; - while (j < len) { + while (j < (int)len) { if (xsock->flags & SOCKTELNET && buffer1[j] == TN_IAC) buffer2[i++] = TN_IAC; /* double IAC */ buffer2[i] = unmapchar(buffer1[j]); @@ -2836,6 +2841,7 @@ conString *fgprompt(void) int tog_lp(Var *var) { + (void)var; if (!fsock) { /* do nothing */ } else if (lpflag) { @@ -2863,6 +2869,7 @@ int handle_prompt_func(conString *str) static void handle_prompt(String *str, int offset, int confirmed) { + (void)offset; runall(1, xsock->world); /* run prompted processes */ if (xsock->prompt) { unprompt(xsock, 0); diff --git a/src/tfio.c b/src/tfio.c index 735dfdb..b1db85a 100644 --- a/src/tfio.c +++ b/src/tfio.c @@ -75,7 +75,7 @@ void init_tfio(void) { int i; - for (i = 0; i < sizeof(filemap)/sizeof(*filemap); i++) + for (i = 0; i < (int)(sizeof(filemap)/sizeof(*filemap)); i++) filemap[i] = NULL; init_list(userfilelist); @@ -985,6 +985,8 @@ TFILE *find_usable_tfile(const char *handle, int mode) struct Value *handle_liststreams_command(String *args, int offset) { int count = 0; + (void)args; + (void)offset; TFILE *file; ListEntry *node; diff --git a/src/util.c b/src/util.c index a3c432b..b959ae0 100644 --- a/src/util.c +++ b/src/util.c @@ -552,6 +552,7 @@ char nextopt(const char **arg, ValueUnion *uval, int *type, int *offp) #if HAVE_TZSET int ch_timezone(Var *var) { + (void)var; tzset(); return 1; } @@ -559,6 +560,7 @@ int ch_timezone(Var *var) int ch_locale(Var *var) { + (void)var; #if HAVE_SETLOCALE #define tf_setlocale(cat, name, value) \ @@ -589,6 +591,7 @@ int ch_locale(Var *var) int ch_maildelay(Var *var) { + (void)var; mail_update = tvzero; return 1; } @@ -619,6 +622,7 @@ static mail_info_t *add_mail_file(mail_info_t *newlist, char *name) int ch_mailfile(Var *var) { + (void)var; const char *path, *end; char *name, *p; mail_info_t *newlist = NULL; diff --git a/src/world.c b/src/world.c index 3f16cdf..09dbed1 100644 --- a/src/world.c +++ b/src/world.c @@ -435,6 +435,7 @@ void mapworld(void (*func)(World *world)) /* used by %{default_charset} */ int ch_default_charset(Var *var) { + (void)var; UErrorCode err = U_ZERO_ERROR; UConverter *cnv = ucnv_open(default_charset->data, &err); diff --git a/tests/test_main.c b/tests/test_main.c index 4f752df..bba3fbf 100644 --- a/tests/test_main.c +++ b/tests/test_main.c @@ -980,7 +980,12 @@ static void test_regex_compat(void) extern struct Value *handle_def_command(String *args, int offset); extern struct Value *handle_undefn_command(String *args, int offset); -static void dummy_free(void *datum, const char *file, int line) {} +static void dummy_free(void *datum, const char *file, int line) +{ + (void)datum; + (void)file; + (void)line; +} static void test_regression_fixes(void) {