summaryrefslogtreecommitdiffhomepage
path: root/src/complete.c
Commit message (Collapse)AuthorAgeFilesLines
* C23: nullptr for null pointers, constexpr for typed constantsSean Kurtz6 days1-1/+1
| | | | | | | | | | | | | | nullptr in every place a null pointer constant was meant; NULL is gone from src/. constexpr where it improves on #define without costing anything: the IGGCSI00 work-area offsets and sizes, and the scalar sizes MVS_DSN_MAX, CSI_FIELD_LEN, CSI_WORK_MIN, PDS_DIRBLK, CSI_WORK, CSI_MAX_CALLS. A constexpr in C is a constant expression, so it still bounds the arrays that use it, and it now carries a type and can be checked with static_assert. Feature switches (#if), the CSIETYPE/EBCDIC byte constants read as octets, and the related-constant enum sets stay as they were.
* z/OS: load IGGCSI00 once and keep the block for the shellSean Kurtz11 days1-1/+1
| | | | | | | | | | | | | | | | | | | | The search interface was reached through LINK, which asked the system to find and attach the module on every call -- and completion issues a call per Tab. The glue now LOADs the module on the first call, writes its entry point into the block, and branches to it directly afterwards, and the block itself is taken from 31-bit storage on the first search and kept, because IGGCSI00 is AMODE 31 and all three of its addresses have to stay below 2 GB. The block is declared packed, so the compiler cannot add padding the assembler's offsets do not know about, and aligned(8), so the save area starts on a doubleword. Its name field is spelled in IBM-1047 bytes rather than as a C string, so the module is named the same way whatever character mode this build runs in. Verified on the machine: SYS1.MA* returns SYS1.MACLIB, SYS1.* returns 135 names, and Tab in an interactive shell completes //'SYS1.MA to //'SYS1.MACLIB' and lists the members of that PDS.
* docs: say it in short sentencesSean Kurtz12 days1-4/+4
| | | | | | | | | | | | | DESIGN.md, README.md and the Doxygen comments leaned on semicolons to join clauses and on trailing "which" clauses to add afterthoughts. Both read as machine-written prose. Each joined clause is now its own sentence, and the afterthoughts are either part of the sentence or a sentence of their own. Also corrected: README said C11 in two places (the tree builds C17), the completion section still described the pre-HLQ-rule filters and the 64-call resume limit, and the z/OS job-control note still called SPAWN_SETTCPGRP unverified.
* completion: no catalog search until a high-level qualifier is completeSean Kurtz12 days1-6/+30
| | | | | | | | | | | | | | | A filter whose first qualifier is generic makes Catalog Management resolve aliases generically, and the manual warns that a generic high-level qualifier can select several catalogs at once: a high-level of "**" means every user catalog. Tab is no reason to ask that of the catalog address space, so completion waits until a whole high-level qualifier is typed before it searches at all. The searches are narrower too: entry types U (user catalog connector) and X (alias) are excluded, since they are not data set names; the required return-area length is checked before a resume, as Managing Catalogs asks; and the editor lists at most one screenful of candidates, with a count of the rest, instead of a fixed 200.
* z/OS: one catalog per completion search, and stop after two callsSean Kurtz12 days1-0/+2
| | | | | | | | | | | | | | CSIS1CAT keeps a generic high-level qualifier from fanning a Tab key out over every alias it matches plus the master catalog, which is what Managing Catalogs warns about for CSIFILTK with generic filters. Two IGGCSI00 calls already return about 2200 names -- one call fills the 64000-byte work area with ~1100 -- so 64 was sweeping a whole catalog per keystroke for names no screen could show. Also: `//'<tab>` searched for "*" and "*.*" before the filter check refused them; it now returns before allocating anything, and tests/run.sh can compare an EBCDIC build's transcript against a .ebcdic.exp.
* z/OS: bound the below-the-bar storage CSI completion usesSean Kurtz12 days1-2/+5
| | | | | | One 64 KB block, freed before the search returns, and a nested search is refused rather than given a second one. The second catalog search is skipped once the candidate list is full.
* completion: bound the name before searching for itSean Kurtz12 days1-1/+2
| | | | | | GCC's -Wformat-truncation is right: the search patterns are built from the typed word, so check its length first. The pwd.h include went with the HLQ code it served.
* completion: stop guessing the HLQ for a bare //NAMESean Kurtz12 days1-56/+16
| | | | | | | `//NAME` completed against <user>.NAME, which meant assuming a TSO profile. It now offers nothing: only `//'DSN` and `//DD:` complete. The quoted member form keeps working, and the tests drop the relative cases.
* z/OS: file tagging, catalog completion, time, and per-command optionsSean Kurtz2026-11-151-2/+193
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Tagging and conversion (sys_zos.c, redir.c, input.c, var.c, exec.c): - _TAG_REDIR_IN/OUT/ERR as /bin/sh documents them, cached by variable hooks so redirection tests a byte; honoured as a prefix on external commands and on pipeline stages. - ASCII builds tag new output and here-document files as text, tag pipes IBM-1047 (set +o pipetag to stop), and switch on autoconvert. - Scripts, . files, profile and ENV are read in either character set: tagged files get F_CONTROL_CVT, untagged ones are sniffed. - tag/chtag primitives (sys_tag_get/sys_tag_set) for a builtin to come. Data set completion (complete.c, mvsfmt.[ch], zos_csi.s): - //'HLQ.PART, "//'HLQ.PART, //NAME (user HLQ), //'DSN(MEM, //DD:NAME complete one qualifier at a time from the Catalog Search Interface, PDS directories and the TIOT. - IGGCSI00 is called through HLASM glue that switches to AMODE 31 and keeps every register and parameter below the bar (VERIFY). - The work-area, directory and TIOT decoders are portable and run on Linux against a stand-in catalog that produces the real EBCDIC bytes, including CSI resume and directory-block splits; fuzzed with libFuzzer (make fuzz). - A lone completion inside quotes now closes the quote. Other z/OS features: - time [-p] keyword with shell/children CPU split. - set -o jobnames (_BPX_JOBNAME per command), set -o shareas (_BPX_SHAREAS=YES for foreground commands only), set -o msgid (ZSHnnnnE/W message IDs), ulimit -M (MEMLIMIT), ZOS_SYSNAME, ZOS_SYSPLEX, ZOS_RELEASE, ZOS_ASID, ZOS_JOBNAME, prompt \S. - BPXWDYN entry point for an alloc builtin to come. Checking z/OS code off z/OS: - make zos-lint compiles sys_zos.c against declarations transcribed from the z/OS headers, and the rest with the MVS paths forced on. - make mvs-asan runs the suite with the MVS paths on, under ASan/UBSan. - make asan and make valgrind now check for leaks.
* Add extensions, job control and the interactive layer; convert to C11Sean Kurtz2026-11-131-0/+263
Language: $'...', aliases, function keyword, (( )) and let, typeset and integer, print, whence, setvar, ulimit, read -t, RANDOM, SECONDS, the ERR trap, trap -p, chdir, and more set -o names. Job control: a job table, process groups, terminal hand-over through the spawn layer, jobs/fg/bg, wait %n and kill %n. Interactive: prompt expansion, a built-in line editor with emacs and vi modes, completion, history with fc and HISTFILE, and libedit as a compile-time alternative (make EDIT=libedit LDLIBS=-ledit). The source is now C11 (was C23), uses typedef'd structs and enums, and has Doxygen comments throughout. Adds .clang-tidy, .clangd and a Doxyfile.