diff options
| author | Sean Kurtz <seankurtz75@gmail.com> | 2026-11-24 11:52:01 -0600 |
|---|---|---|
| committer | Sean Kurtz <seankurtz75@gmail.com> | 2026-11-24 11:52:01 -0600 |
| commit | 9911f3c83d003bce605192dcf3911d3ff5d5e23c (patch) | |
| tree | 52b5fc0224f018e4e0d3b0b7154e28d34eb901df | |
| parent | 44b584e03b4ec6326f01afb389d3fc30d7bfc011 (diff) | |
| download | whoson-9911f3c83d003bce605192dcf3911d3ff5d5e23c.tar.gz | |
Makefile: build in ASCII character mode
Switch the default from -fzos-le-char-mode=ebcdic to =ascii (with -O3),
so string literals share the ASCII encoding of ZOAU's returned text and
of the ssh channel. Install with chmod +x. Docs and code comments
followed the old EBCDIC claim.
| -rw-r--r-- | Makefile | 11 | ||||
| -rw-r--r-- | README.md | 11 | ||||
| -rw-r--r-- | whoson.c | 8 |
3 files changed, 16 insertions, 14 deletions
@@ -18,10 +18,9 @@ # the sidedeck as a DD and fail with IEW2763S. The library also has to be # reachable at run time through LIBPATH. # -# EBCDIC is deliberate: the ssh channel converts terminal output from EBCDIC -# to ASCII, and ZOAU returns its text in EBCDIC. Source stays ASCII-tagged; -# the compiler turns literals into EBCDIC. Only opercmd's argument string is -# converted to ASCII, in whoson.c. +# ASCII character mode is deliberate: the text ZOAU returns and the text the +# ssh channel carries are ASCII, so literals stay ASCII and the display fields +# compare the way they are parsed. Source stays ASCII-tagged. # # POSIX make syntax: z/OS has IBM's make as well as GNU make. Avoid ?=, # which IBM's make does not accept; .PHONY is supported by both. @@ -32,7 +31,7 @@ BINDIR = $(PREFIX)/bin CC = /usr/lpp/IBM/cnw/v2r1/openxl/bin/ibm-clang CPPFLAGS = -D_XOPEN_SOURCE=600 -D_POSIX_C_SOURCE=200809L -D_ALL_SOURCE \ -D_EXT -CFLAGS = -std=c17 -O2 -m64 -fzos-le-char-mode=ebcdic -Wall -Wextra \ +CFLAGS = -std=c17 -O3 -m64 -fzos-le-char-mode=ascii -Wall -Wextra \ -Wpedantic -Wshadow -Wconversion -I$(ZOAU_HOME)/include ZOAU_DLL = $(ZOAU_HOME)/lib/zoautil.x CEEOPTS = HEAPCHK(ON,1,32),RPTSTG(ON),FILETAG(AUTOCVT,AUTOTAG),POSIX(ON) @@ -52,7 +51,7 @@ whoson: whoson.c install: whoson mkdir -p $(BINDIR) cp whoson $(BINDIR)/whoson - chmod 755 $(BINDIR)/whoson + chmod +x $(BINDIR)/whoson check: whoson LIBPATH=$(ZOAU_HOME)/lib:$$LIBPATH \ @@ -33,7 +33,7 @@ its sidedeck imports `CODE64`. ## Build and run ```sh -make # builds ./whoson with ibm-clang, -m64, EBCDIC character mode +make # builds ./whoson with ibm-clang, -m64, ASCII character mode make check # runs it under the CEE heap checker and storage report make install # copies it to ~/.local/bin, creating it if needed ``` @@ -44,8 +44,9 @@ make install # copies it to ~/.local/bin, creating it if needed make PREFIX=/usr/local install # -> /usr/local/bin/whoson ``` -The sources are ASCII and stay that way; the compiler turns the literals into -EBCDIC, which is what ZOAU returns and what the console display looks like. +The sources are ASCII and stay that way; the build is in ASCII character mode +(`-fzos-le-char-mode=ascii`), which is what ZOAU returns and what the ssh +channel carries. ## How the data is produced @@ -61,8 +62,8 @@ so the program does not shell out to `opercmd`: a daemon account and is dropped, which keeps started tasks out of the list. The vector's `opercmd` splits its argument string into `argv` without a shell, -so the console command is passed quoted (`"D TS,A"`) as a single argument, in -EBCDIC. Unquoted, the `D` is read as an option letter and the call fails with +so the console command is passed quoted (`"D TS,A"`) as a single argument. +Unquoted, the `D` is read as an option letter and the call fails with `opercmd`'s usage text and rc 2. ## License @@ -14,8 +14,9 @@ * The vector's opercmd splits its argument string into argv without a shell, * so the console command has to arrive as one argv element: it is passed in * double quotes, "D TS,A". Unquoted, the D is taken for an option letter and - * the call fails with opercmd's usage text (rc 2). The arguments stay in - * EBCDIC; an ASCII-converted copy fails with rc 1 and no message. + * the call fails with opercmd's usage text (rc 2). The program is built in + * ASCII character mode, so the argument and the returned text share one + * encoding. * * A TSO/E session reports its own CPU time (CT), elapsed time (ET), job id * (WUID/SCL/P) and region (RGP), so those columns need no second source. An @@ -379,7 +380,8 @@ static int compare_rows(const void *a, const void *b) } /* Run one display; returns 0 and a NUL-terminated copy of stdout, or -1. - * EBCDIC, and quoted so that the whole command is one argv element. */ + * ASCII (the build's character mode), and quoted so that the whole command is + * one argv element. */ static int run_display(zoautil_vector4_t *vector, const char *args, zoautil_options_t options, char **out) { |
