executor/util/uncruft.pl

140 lines
2.9 KiB
Perl
Executable File

#!/usr/bin/perl -ni
s/^(\#\w+)[ \t]+/$1 /g;
s/^\#ifdef\s+([\w\d]+)/\#if defined ($1)/g;
s/^\#ifndef\s+([\w\d]+)/\#if !defined ($1)/g;
s/^\#include <([A-Z][\w\d\.]*)>/\#include \"$1\"/g;
s/^\#include <rsys\/([\w\d\.]+)>/\#include \"rsys\/$1\"/g;
s/^\#include\s+\"libcproto.h\"\s*$//g;
s/^\#include\s+\<pascal.h\>\s*$//g;
s/CW\s*\(([0-9]+)\)/CWC ($1)/g;
s/CL\s*\(([0-9]+)\)/CLC ($1)/g;
s/CW\s*\((0x[0-9a-fA-F]+)\)/CWC ($1)/g;
s/CL\s*\((0x[0-9a-fA-F]+)\)/CLC ($1)/g;
s/true/TRUE/g;
s/false/FALSE/g;
s/Uabort/abort/g;
s/Uaccept/accept/g;
s/Uatan2/atan2/g;
s/Uatoi/atoi/g;
s/Ubcopy/bcopy/g;
s/Ubind/bind/g;
s/Ubrk/brk/g;
s/Ubzero/bzero/g;
s/Uclose/close/g;
s/Ucos/cos/g;
s/Udbm_close/dbm_close/g;
s/Udbm_delete/dbm_delete/g;
s/Udbm_fetch/dbm_fetch/g;
s/Udbm_firstkey/dbm_firstkey/g;
s/Udbm_nextkey/dbm_nextkey/g;
s/Udbm_store/dbm_store/g;
s/Udbm_open/dbm_open/g;
s/Udup/dup/g;
s/Uexeclp/execlp/g;
s/Uexecl/execl/g;
s/Uexit/exit/g;
s/Ufclose/fclose/g;
s/Ufcntl/fcntl/g;
s/Ufflush/fflush/g;
s/Ufileno/fileno/g;
s/Uflock/flock/g;
s/Ufork/fork/g;
s/Ufprintf/fprintf/g;
s/Ufread/fread/g;
s/Ufree/free/g;
s/Ufseek/fseek/g;
s/Ufstat/fstat/g;
s/Ufsync/fsync/g;
s/Uftruncate/ftruncate/g;
s/Ufwrite/fwrite/g;
s/Ugetenv/getenv/g;
s/Ugethostname/gethostname/g;
s/Ugetpid/getpid/g;
s/Ugetpwuid/getpwuid/g;
s/Ugettimeofday/gettimeofday/g;
s/Ugeteuid/geteuid/g;
s/Ugetuid/getuid/g;
s/Ugetwd/getwd/g;
s/Ugmtime/gmtime/g;
s/Uindex/index/g;
s/Uioctl/ioctl/g;
s/Ukill/kill/g;
s/Ulisten/listen/g;
s/Ulocaltime/localtime/g;
s/Ulockf/lockf/g;
s/Ulseek/lseek/g;
s/Umalloc/malloc/g;
s/Umemcpy/memcpy/g;
s/Upipe/pipe/g;
s/Uprintf/printf/g;
s/Uqsort/qsort/g;
s/Urand/rand/g;
s/Uread/read/g;
s/Urealloc/realloc/g;
s/Urindex/rindex/g;
s/Usbrk/sbrk/g;
s/Usscanf/sscanf/g;
s/Usetitimer/setitimer/g;
s/Usetpgrp/setpgrp/g;
s/Usettimeofday/settimeofday/g;
s/Usetuid/setuid/g;
s/Usigblock/sigblock/g;
s/Usigmask/sigmask/g;
s/Usigstack/sigstack/g;
s/Usignal/signal/g;
s/Usigpause/sigpause/g;
s/Usigsetmask/sigsetmask/g;
s/Usigvec/sigvec/g;
s/Usin/sin/g;
s/Usocket/socket/g;
s/Usprintf/sprintf/g;
s/Usqrt/sqrt/g;
s/Ustrcmp/strcmp/g;
s/Ustrchr/strchr/g;
s/Ustrcpy/strcpy/g;
s/Ustrlen/strlen/g;
s/Ustrncmp/strncmp/g;
s/Ustrncpy/strncpy/g;
s/Usync/sync/g;
s/Usyscall/syscall/g;
s/Utime/time/g;
s/Uumask/umask/g;
s/Uvalloc/valloc/g;
s/Uwait3/wait3/g;
s/Uwait4/wait4/g;
s/Uwrite/write/g;
s/Uclosedir/closedir/g;
s/Ureaddir/readdir/g;
s/Udirent_t/struct dirent/g;
s/Udirect_t/struct direct/g;
s/Utimeval_t/struct timeval/g;
s/Utimezone_t/struct timezone/g;
s/Uitimerval_t/struct itimerval/g;
s/Upasswd_t/struct passwd/g;
s/Urusage_t/struct rusage/g;
s/Usigcontext_t/struct sigcontext/g;
s/Ustat_t/struct stat/g;
s/Ustatfs_t/struct statfs/g;
s/Utm_t/struct tm/g;
s/Uwait_t/union wait/g;
s/UDBM_t/DBM/g;
s/Udatum_t/datum/g;
s/UFILE_t/FILE/g;
s/UDIR_t/DIR/g;
s/Usockaddr_t/struct sockaddr/g;
s/Udrive_info_t/struct drive_info/g;
s/Usgttyb_t/struct sgttyb/g;
s/Utchars_t/struct tchars/g;
s/Usigstack_t/struct sigstack/g;
s/Usigvec_t/struct sigvec/g;
print;