ref: 7fbd3fd4fea60d3d0252dcceb20deed7cdca3873
dir: /sys/src/9/port/mksystab/
#!/bin/rc file=/sys/src/libc/9syscall/sys.h cat <<'!' #include "/sys/src/libc/9syscall/sys.h" typedef uintptr Syscall(va_list); ! sed 's/#define[ ]*([A-Z0-9_][A-Z0-9_]*).*/SYS\1/; s/SYSSYSR1/SYSR1/' $file | tr A-Z a-z | sed 's/.*/Syscall &;/' cat <<'!' Syscall sysdeath; Syscall *systab[]={ ! sam -d $file >[2] /dev/null <<'!' ,s/#define.([A-Z0-9_]+).*/ [\1] SYS\1,/g ,x/SYS[A-Z0-9_]+,/ | tr A-Z a-z ,x/syssysr1/c/sysr1 ,x/sys_x[0-9]*/c/sysdeath ,x v/\[......+\]/ s/\]/] ,p ! cat <<'!' }; char *sysctab[]={ ! sam -d $file >[2] /dev/null <<'!' ,s/#define.([A-Z0-9_]+).*/ [\1] "\1",/g ,x/"[A-Z0-9_]+",/ y/"[A-Z]/ | tr A-Z a-z ,x/_"/c/" ,x/Sysr1/c/Running ,x/Rendezvous/c/Rendez ,x v/\[......+\]/ s/\]/] ,p ! cat <<'!' }; int nsyscall = (sizeof systab/sizeof systab[0]); !