From 6c64d97e70984c77be3cd8d4e03e9adf717e02fb Mon Sep 17 00:00:00 2001 From: user Date: Thu, 16 Jul 2026 08:25:35 +0200 Subject: shell: I/O redirection (>/<) and pipes (|); rewrite shell in C - kernel I/O routing: PCB gains PROC_STDIN/PROC_STDOUT (default console $FF), inherited across fork. KGetc/KPutc route read/write/putc to the console or a file fd. New syscalls: putc(16), setin(17), setout(18), lookup(19). read/write now go through the routing; putc/puts/nl use SYS_PUTC. - sys_lookup + NameTable move command-name resolution into the kernel. - shell rewritten in C (c/sh.c): tokenizes a line, parses > / < / |, and drives fork+setin/setout+exec+wait. Pipes run as 'a > __pipe ; b < __pipe' (temp file). asm shell + cmdtab removed; StrEqual/SkipName kept for sys_lookup. - libc: fork/exec/wait/setin/setout/lookup wrappers. - verified: echo>file, cat file, wc A, CF=EOF) DEF SYS_PUTB EQU 13 ; append a byte to an open file (B=fd, E=byte) DEF SYS_LIST EQU 14 ; list a directory slot (B=slot, DE=namebuf) DEF SYS_REMOVE EQU 15 ; delete a file (DE=name) -DEF SYS_MAX EQU 16 +DEF SYS_PUTC EQU 16 ; write a byte to stdout (E=byte) +DEF SYS_SETIN EQU 17 ; set current stdin fd (B=fd, $FF=console) +DEF SYS_SETOUT EQU 18 ; set current stdout fd (B=fd, $FF=console) +DEF SYS_LOOKUP EQU 19 ; program id for a command name (DE=name -> A=id/$FF) +DEF SYS_MAX EQU 20 ; (SYS_OPEN=4 / SYS_CLOSE=5 are now implemented by the filesystem) ; ----------------------------------------------------------------------------- -- cgit v1.3.1-sl0p