Plan 9 from Bell Labs’s /usr/web/sources/plan9/sys/src/9/port/mksystab

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


#!/bin/rc

file=/sys/src/libc/9syscall/sys.h

cat <<'!'
#include "/sys/src/libc/9syscall/sys.h"

typedef long Syscall(ulong*);

!

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]);
!

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.