summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert de Bath <rdebath@poboxes.com>1996-03-24 21:25:23 +0100
committerLubomir Rintel <lkundrak@v3.sk>2013-10-23 23:29:54 +0200
commitdcc973ea3e31710429858c99d4f040334ac67c06 (patch)
tree8883b902eb18eba489957b7f03caa491fd7992a7
parentfe22c37817ce338fbbc90b239320248c270957fa (diff)
downloaddev86-dcc973ea3e31710429858c99d4f040334ac67c06.tar.gz
Import Dev86-0.0.5.tar.gzv0.0.5
-rw-r--r--Libc_version2
-rw-r--r--Make.defs6
-rw-r--r--Makefile38
-rw-r--r--README4
-rw-r--r--README.ash2
-rw-r--r--bcc/Makefile3
-rw-r--r--bcc/bcc.c21
-rw-r--r--dis88/Makefile10
l---------dis88/a.out.h1
l---------libc-0.0.4/include/linuxmt1
-rw-r--r--libc-0.0.4/include/utmp.h48
-rw-r--r--libc-0.0.4/pwd/__getpwent.c152
-rwxr-xr-xlibc-0.0.4/pwd/test_pwdbin6436 -> 0 bytes
-rw-r--r--libc-0.0.4/stdio1/libc.a0
-rw-r--r--libc-0.0.4/stdio2/Funcs43
-rw-r--r--libc-0.0.4/stdio2/stdio.c.old730
-rw-r--r--libc/COPYING (renamed from libc-0.0.4/COPYING)0
-rw-r--r--libc/Changes (renamed from libc-0.0.4/Changes)5
-rw-r--r--libc/Config_sh141
-rw-r--r--libc/Contributors (renamed from libc-0.0.4/Contributors)2
-rw-r--r--libc/KERNEL (renamed from libc-0.0.4/KERNEL)0
-rw-r--r--libc/MAGIC (renamed from libc-0.0.4/MAGIC)0
-rw-r--r--libc/Make.defs (renamed from libc-0.0.4/Make.defs)10
-rw-r--r--libc/Makefile (renamed from libc-0.0.4/Makefile)43
-rwxr-xr-xlibc/New_subdir (renamed from libc-0.0.4/New_subdir)4
-rw-r--r--libc/Pre_main (renamed from libc-0.0.4/Pre_main)0
-rw-r--r--libc/README (renamed from libc-0.0.4/README)68
-rw-r--r--libc/TODO (renamed from libc-0.0.4/TODO)37
-rw-r--r--libc/bcc/Config (renamed from libc-0.0.4/bcc/Config)0
-rw-r--r--libc/bcc/Makefile (renamed from libc-0.0.4/bcc/Makefile)4
-rw-r--r--libc/bcc/__ldivmod.c (renamed from libc-0.0.4/bcc/__ldivmod.c)0
-rw-r--r--libc/bcc/alloca.c (renamed from libc-0.0.4/bcc/alloca.c)0
-rw-r--r--libc/bcc/bcc_bsw.c (renamed from libc-0.0.4/bcc/bcc_bsw.c)0
-rw-r--r--libc/bcc/bcc_int.c (renamed from libc-0.0.4/bcc/bcc_int.c)0
-rw-r--r--libc/bcc/bcc_io.c (renamed from libc-0.0.4/bcc/bcc_io.c)0
-rw-r--r--libc/bcc/bcc_long.c (renamed from libc-0.0.4/bcc/bcc_long.c)0
-rw-r--r--libc/bcc/heap.c (renamed from libc-0.0.4/bcc/heap.c)0
-rw-r--r--libc/crt0.c (renamed from libc-0.0.4/crt0.c)0
-rw-r--r--libc/crt0.o (renamed from libc-0.0.4/crt0.o)bin125 -> 125 bytes
-rw-r--r--libc/error/Config (renamed from libc-0.0.4/error/Config)0
-rw-r--r--libc/error/Makefile (renamed from libc-0.0.4/error/Makefile)4
-rw-r--r--libc/error/README (renamed from libc-0.0.4/error/README)0
-rw-r--r--libc/error/__assert.c (renamed from libc-0.0.4/error/__assert.c)0
-rw-r--r--libc/error/error.c (renamed from libc-0.0.4/error/error.c)0
-rw-r--r--libc/error/liberror.txt (renamed from libc-0.0.4/error/liberror.txt)0
-rw-r--r--libc/error/perror.c (renamed from libc-0.0.4/error/perror.c)0
-rw-r--r--libc/error/sys_errlist.c (renamed from libc-0.0.4/error/sys_errlist.c)0
-rw-r--r--libc/error/sys_siglist.c (renamed from libc-0.0.4/error/sys_siglist.c)0
-rw-r--r--libc/grp/Config1
-rw-r--r--libc/grp/Makefile (renamed from libc-0.0.4/grp/Makefile)4
-rw-r--r--libc/grp/__getgrent.c (renamed from libc-0.0.4/grp/__getgrent.c)80
-rw-r--r--libc/grp/config-grp.h (renamed from libc-0.0.4/grp/config-grp.h)0
-rw-r--r--libc/grp/config.h65
-rw-r--r--libc/grp/fgetgrent.c (renamed from libc-0.0.4/grp/fgetgrent.c)0
-rw-r--r--libc/grp/getgrgid.c (renamed from libc-0.0.4/grp/getgrgid.c)0
-rw-r--r--libc/grp/getgrnam.c (renamed from libc-0.0.4/grp/getgrnam.c)0
-rw-r--r--libc/grp/grent.c (renamed from libc-0.0.4/grp/grent.c)0
-rw-r--r--libc/grp/initgroups.c (renamed from libc-0.0.4/grp/initgroups.c)2
-rw-r--r--libc/grp/test_grp.c (renamed from libc-0.0.4/grp/test_grp.c)0
-rw-r--r--libc/gtermcap/COPYING339
-rw-r--r--libc/gtermcap/ChangeLog52
-rw-r--r--libc/gtermcap/Makefile21
-rw-r--r--libc/gtermcap/Makefile.old25
-rw-r--r--libc/gtermcap/NEWS12
-rw-r--r--libc/gtermcap/README14
-rw-r--r--libc/gtermcap/termcap.c827
-rw-r--r--libc/gtermcap/tparam.c330
-rw-r--r--libc/gtermcap/version.c2
-rw-r--r--libc/include/a.out.h (renamed from libc-0.0.4/include/a.out.h)0
-rw-r--r--libc/include/ar.h (renamed from libc-0.0.4/include/ar.h)0
-rw-r--r--libc/include/assert.h (renamed from libc-0.0.4/include/assert.h)0
-rw-r--r--libc/include/ctype.h (renamed from libc-0.0.4/include/ctype.h)0
-rw-r--r--libc/include/dirent.h (renamed from libc-0.0.4/include/dirent.h)9
-rw-r--r--libc/include/dos.h (renamed from libc-0.0.4/include/dos.h)0
-rw-r--r--libc/include/errno.h (renamed from libc-0.0.4/include/errno.h)0
-rw-r--r--libc/include/fcntl.h (renamed from libc-0.0.4/include/fcntl.h)0
-rw-r--r--libc/include/features.h (renamed from libc-0.0.4/include/features.h)0
-rw-r--r--libc/include/getopt.h (renamed from libc-0.0.4/include/getopt.h)0
-rw-r--r--libc/include/grp.h (renamed from libc-0.0.4/include/grp.h)0
-rw-r--r--libc/include/limits.h (renamed from libc-0.0.4/include/limits.h)0
-rw-r--r--libc/include/malloc.h (renamed from libc-0.0.4/include/malloc.h)11
-rw-r--r--libc/include/memory.h (renamed from libc-0.0.4/include/memory.h)0
-rw-r--r--libc/include/paths.h (renamed from libc-0.0.4/include/paths.h)0
-rw-r--r--libc/include/pwd.h (renamed from libc-0.0.4/include/pwd.h)0
-rw-r--r--libc/include/regexp.h (renamed from libc-0.0.4/include/regexp.h)0
-rw-r--r--libc/include/regmagic.h (renamed from libc-0.0.4/include/regmagic.h)0
-rw-r--r--libc/include/search.h (renamed from libc-0.0.4/include/search.h)0
-rw-r--r--libc/include/setjmp.h (renamed from libc-0.0.4/include/setjmp.h)0
-rw-r--r--libc/include/sgtty.h (renamed from libc-0.0.4/include/sgtty.h)0
-rw-r--r--libc/include/signal.h (renamed from libc-0.0.4/include/signal.h)0
-rw-r--r--libc/include/stdarg.h (renamed from libc-0.0.4/include/stdarg.h)0
-rw-r--r--libc/include/stddef.h (renamed from libc-0.0.4/include/stddef.h)4
-rw-r--r--libc/include/stdio.h (renamed from libc-0.0.4/include/stdio.h)0
-rw-r--r--libc/include/stdlib.h (renamed from libc-0.0.4/include/stdlib.h)8
-rw-r--r--libc/include/string.h (renamed from libc-0.0.4/string/string.h)1
-rw-r--r--libc/include/strings.h (renamed from libc-0.0.4/include/strings.h)0
-rw-r--r--libc/include/sys/cdefs.h (renamed from libc-0.0.4/include/sys/cdefs.h)0
-rw-r--r--libc/include/sys/errno.h (renamed from libc-0.0.4/include/sys/errno.h)0
-rw-r--r--libc/include/sys/fcntl.h (renamed from libc-0.0.4/include/sys/fcntl.h)0
-rw-r--r--libc/include/sys/file.h (renamed from libc-0.0.4/include/sys/file.h)0
-rw-r--r--libc/include/sys/ioctl.h (renamed from libc-0.0.4/include/sys/ioctl.h)0
-rw-r--r--libc/include/sys/param.h (renamed from libc-0.0.4/include/sys/param.h)0
-rw-r--r--libc/include/sys/signal.h (renamed from libc-0.0.4/include/sys/signal.h)0
-rw-r--r--libc/include/sys/stat.h (renamed from libc-0.0.4/include/sys/stat.h)0
-rw-r--r--libc/include/sys/types.h (renamed from libc-0.0.4/include/sys/types.h)0
-rw-r--r--libc/include/sys/utsname.h18
-rw-r--r--libc/include/sys/wait.h (renamed from libc-0.0.4/include/sys/wait.h)0
-rw-r--r--libc/include/termcap.h (renamed from libc-0.0.4/include/termcap.h)0
-rw-r--r--libc/include/termio.h (renamed from libc-0.0.4/include/termio.h)0
-rw-r--r--libc/include/termios.h (renamed from libc-0.0.4/include/termios.h)0
-rw-r--r--libc/include/time.h (renamed from libc-0.0.4/include/time.h)0
-rw-r--r--libc/include/unistd.h (renamed from libc-0.0.4/include/unistd.h)3
-rw-r--r--libc/include/utime.h (renamed from libc-0.0.4/include/utime.h)0
-rw-r--r--libc/include/utmp.h52
-rw-r--r--libc/include/varargs.h (renamed from libc-0.0.4/include/varargs.h)0
-rw-r--r--libc/kinclude/Config (renamed from libc-0.0.4/kinclude/Config)0
-rw-r--r--libc/kinclude/Makefile18
-rw-r--r--libc/kinclude/arch/errno.h (renamed from libc-0.0.4/kinclude/arch/errno.h)0
-rw-r--r--libc/kinclude/arch/ioctl.h (renamed from libc-0.0.4/kinclude/arch/ioctl.h)0
-rw-r--r--libc/kinclude/arch/types.h (renamed from libc-0.0.4/kinclude/arch/types.h)0
-rw-r--r--libc/kinclude/linuxmt/errno.h (renamed from libc-0.0.4/kinclude/linuxmt/errno.h)0
-rw-r--r--libc/kinclude/linuxmt/fcntl.h (renamed from libc-0.0.4/kinclude/linuxmt/fcntl.h)0
-rw-r--r--libc/kinclude/linuxmt/ioctl.h (renamed from libc-0.0.4/kinclude/linuxmt/ioctl.h)0
-rw-r--r--libc/kinclude/linuxmt/stat.h (renamed from libc-0.0.4/kinclude/linuxmt/stat.h)0
-rw-r--r--libc/kinclude/linuxmt/termios.h (renamed from libc-0.0.4/kinclude/linuxmt/termios.h)0
-rw-r--r--libc/kinclude/linuxmt/types.h (renamed from libc-0.0.4/kinclude/linuxmt/types.h)1
-rw-r--r--libc/libc.a (renamed from libc-0.0.4/libc.a)bin65272 -> 74344 bytes
-rw-r--r--libc/malloc1/Config (renamed from libc-0.0.4/malloc1/Config)0
-rw-r--r--libc/malloc1/Makefile (renamed from libc-0.0.4/malloc1/Makefile)4
-rw-r--r--libc/malloc1/README (renamed from libc-0.0.4/malloc1/README)0
-rw-r--r--libc/malloc1/malloc.c (renamed from libc-0.0.4/malloc1/malloc.c)14
-rw-r--r--libc/malloc1/malloc.h (renamed from libc-0.0.4/malloc1/malloc.h)11
-rw-r--r--libc/malloc2/Config (renamed from libc-0.0.4/malloc2/Config)0
-rw-r--r--libc/malloc2/Makefile (renamed from libc-0.0.4/malloc2/makefile)2
-rw-r--r--libc/malloc2/README (renamed from libc-0.0.4/malloc2/README)0
-rw-r--r--libc/malloc2/malloc.c (renamed from libc-0.0.4/malloc2/malloc.c)0
-rw-r--r--libc/malloc2/malloc.h (renamed from libc-0.0.4/malloc2/malloc.h)0
-rw-r--r--libc/malloc2/stack.c (renamed from libc-0.0.4/malloc2/stack.c)0
-rw-r--r--libc/misc/Config (renamed from libc-0.0.4/misc/Config)0
-rw-r--r--libc/misc/Makefile (renamed from libc-0.0.4/misc/Makefile)13
-rw-r--r--libc/misc/aliases.c (renamed from libc-0.0.4/misc/aliases.c)0
-rw-r--r--libc/misc/atexit.c (renamed from libc-0.0.4/misc/atexit.c)0
-rw-r--r--libc/misc/atoi.c (renamed from libc-0.0.4/misc/atoi.c)0
-rw-r--r--libc/misc/atol.c (renamed from libc-0.0.4/misc/atol.c)0
-rw-r--r--libc/misc/bsearch.c (renamed from libc-0.0.4/misc/bsearch.c)0
-rw-r--r--libc/misc/cputype.c (renamed from libc-0.0.4/misc/cputype.c)0
-rw-r--r--libc/misc/crypt.c50
-rw-r--r--libc/misc/ctype.c (renamed from libc-0.0.4/misc/ctype.c)0
-rw-r--r--libc/misc/getenv.c (renamed from libc-0.0.4/misc/getenv.c)0
-rw-r--r--libc/misc/getopt.c (renamed from libc-0.0.4/misc/getopt.c)0
-rw-r--r--libc/misc/itoa.c (renamed from libc-0.0.4/misc/itoa.c)0
-rw-r--r--libc/misc/lsearch.c (renamed from libc-0.0.4/misc/lsearch.c)0
-rw-r--r--libc/misc/ltoa.c (renamed from libc-0.0.4/misc/ltoa.c)0
-rw-r--r--libc/misc/ltostr.c (renamed from libc-0.0.4/misc/ltostr.c)0
-rw-r--r--libc/misc/popen.c (renamed from libc-0.0.4/misc/popen.c)0
-rw-r--r--libc/misc/putenv.c (renamed from libc-0.0.4/misc/putenv.c)0
-rw-r--r--libc/misc/qsort.c (renamed from libc-0.0.4/misc/qsort.c)0
-rw-r--r--libc/misc/rand.c (renamed from libc-0.0.4/misc/rand.c)0
-rw-r--r--libc/misc/strtod.c (renamed from libc-0.0.4/misc/strtod.c)0
-rw-r--r--libc/misc/strtol.c (renamed from libc-0.0.4/misc/strtol.c)0
-rw-r--r--libc/misc/system.c (renamed from libc-0.0.4/misc/system.c)0
-rw-r--r--libc/msdos/Config (renamed from libc-0.0.4/msdos/Config)0
-rw-r--r--libc/msdos/Makefile (renamed from libc-0.0.4/msdos/Makefile)12
-rw-r--r--libc/msdos/Notes (renamed from libc-0.0.4/msdos/TODO)0
-rw-r--r--libc/msdos/i86.c (renamed from libc-0.0.4/msdos/i86.c)0
-rw-r--r--libc/msdos/msdos.c (renamed from libc-0.0.4/msdos/msdos.c)0
-rw-r--r--libc/pwd/Config (renamed from libc-0.0.4/pwd/Config)0
-rw-r--r--libc/pwd/Makefile (renamed from libc-0.0.4/pwd/Makefile)4
-rw-r--r--libc/pwd/__getpwent.c99
-rw-r--r--libc/pwd/fgetpwent.c (renamed from libc-0.0.4/pwd/fgetpwent.c)0
-rw-r--r--libc/pwd/getpw.c (renamed from libc-0.0.4/pwd/getpw.c)0
-rw-r--r--libc/pwd/getpwnam.c (renamed from libc-0.0.4/pwd/getpwnam.c)0
-rw-r--r--libc/pwd/getpwuid.c (renamed from libc-0.0.4/pwd/getpwuid.c)0
-rw-r--r--libc/pwd/putpwent.c (renamed from libc-0.0.4/pwd/putpwent.c)0
-rw-r--r--libc/pwd/pwent.c (renamed from libc-0.0.4/pwd/pwent.c)2
-rw-r--r--libc/pwd/test_pwd.c (renamed from libc-0.0.4/pwd/test_pwd.c)4
-rw-r--r--libc/regexp/Config (renamed from libc-0.0.4/regexp/Config)0
-rw-r--r--libc/regexp/Makefile (renamed from libc-0.0.4/regexp/Makefile)2
-rw-r--r--libc/regexp/Makefile.org (renamed from libc-0.0.4/regexp/Makefile.org)0
-rw-r--r--libc/regexp/README (renamed from libc-0.0.4/regexp/README)0
-rw-r--r--libc/regexp/README.rdb (renamed from libc-0.0.4/regexp/README.rdb)0
-rw-r--r--libc/regexp/patch.1 (renamed from libc-0.0.4/regexp/patch.1)0
-rw-r--r--libc/regexp/patch.2 (renamed from libc-0.0.4/regexp/patch.2)0
-rw-r--r--libc/regexp/patch.3 (renamed from libc-0.0.4/regexp/patch.3)0
-rw-r--r--libc/regexp/patch.4 (renamed from libc-0.0.4/regexp/patch.4)0
-rw-r--r--libc/regexp/regerror.c (renamed from libc-0.0.4/regexp/regerror.c)0
-rw-r--r--libc/regexp/regexp.3 (renamed from libc-0.0.4/regexp/regexp.3)0
-rw-r--r--libc/regexp/regexp.c (renamed from libc-0.0.4/regexp/regexp.c)0
-rw-r--r--libc/regexp/regexp.h (renamed from libc-0.0.4/regexp/regexp.h)0
-rw-r--r--libc/regexp/regmagic.h (renamed from libc-0.0.4/regexp/regmagic.h)0
-rw-r--r--libc/regexp/regsub.c (renamed from libc-0.0.4/regexp/regsub.c)0
-rw-r--r--libc/regexp/tests (renamed from libc-0.0.4/regexp/tests)0
-rw-r--r--libc/regexp/timer.c (renamed from libc-0.0.4/regexp/timer.c)0
-rw-r--r--libc/regexp/try.c (renamed from libc-0.0.4/regexp/try.c)0
-rw-r--r--libc/stdio1/BUGS (renamed from libc-0.0.4/stdio1/BUGS)0
-rw-r--r--libc/stdio1/Config (renamed from libc-0.0.4/stdio1/Config)0
-rw-r--r--libc/stdio1/Makefile (renamed from libc-0.0.4/stdio1/makefile)4
-rw-r--r--libc/stdio1/NOTICE (renamed from libc-0.0.4/stdio1/NOTICE)0
-rw-r--r--libc/stdio1/README (renamed from libc-0.0.4/stdio1/README)0
-rw-r--r--libc/stdio1/TODO (renamed from libc-0.0.4/stdio1/TODO)0
-rw-r--r--libc/stdio1/__ffillbuf.c (renamed from libc-0.0.4/stdio1/__ffillbuf.c)0
-rw-r--r--libc/stdio1/__stdio_init.c (renamed from libc-0.0.4/stdio1/__stdio_init.c)0
-rw-r--r--libc/stdio1/fclose.c (renamed from libc-0.0.4/stdio1/fclose.c)0
-rw-r--r--libc/stdio1/fcntl.h (renamed from libc-0.0.4/stdio1/fcntl.h)0
-rw-r--r--libc/stdio1/fflush.c (renamed from libc-0.0.4/stdio1/fflush.c)0
-rw-r--r--libc/stdio1/fgetc.c (renamed from libc-0.0.4/stdio1/fgetc.c)0
-rw-r--r--libc/stdio1/fgets.c (renamed from libc-0.0.4/stdio1/fgets.c)0
-rw-r--r--libc/stdio1/fopen.c (renamed from libc-0.0.4/stdio1/fopen.c)0
-rw-r--r--libc/stdio1/fputc.c (renamed from libc-0.0.4/stdio1/fputc.c)0
-rw-r--r--libc/stdio1/fputs.c (renamed from libc-0.0.4/stdio1/fputs.c)0
-rw-r--r--libc/stdio1/idealgetline.c (renamed from libc-0.0.4/stdio1/idealgetline.c)0
-rw-r--r--libc/stdio1/old_printf.c (renamed from libc-0.0.4/stdio1/old_printf.c)0
-rw-r--r--libc/stdio1/printf.c (renamed from libc-0.0.4/stdio1/printf.c)0
-rw-r--r--libc/stdio1/puts.c (renamed from libc-0.0.4/stdio1/puts.c)0
-rw-r--r--libc/stdio1/scanf.c (renamed from libc-0.0.4/stdio1/scanf.c)0
-rw-r--r--libc/stdio1/stdio.h (renamed from libc-0.0.4/stdio1/stdio.h)0
-rwxr-xr-xlibc/stdio1/test.sh (renamed from libc-0.0.4/stdio1/test.sh)0
-rw-r--r--libc/stdio2/Config (renamed from libc-0.0.4/stdio2/Config)0
-rw-r--r--libc/stdio2/Makefile (renamed from libc-0.0.4/stdio2/Makefile)4
-rw-r--r--libc/stdio2/printf.c (renamed from libc-0.0.4/stdio2/printf.c)0
-rw-r--r--libc/stdio2/scanf.c (renamed from libc-0.0.4/stdio2/scanf.c)0
-rw-r--r--libc/stdio2/stdio.c (renamed from libc-0.0.4/stdio2/stdio.c)3
-rw-r--r--libc/stdio2/stdio.h (renamed from libc-0.0.4/stdio2/stdio.h)0
-rw-r--r--libc/string/Config (renamed from libc-0.0.4/string/Config)0
-rw-r--r--libc/string/Makefile (renamed from libc-0.0.4/string/Makefile)4
-rw-r--r--libc/string/strcasecmp.c (renamed from libc-0.0.4/string/strcasecmp.c)0
-rw-r--r--libc/string/strcspn.c (renamed from libc-0.0.4/string/strcspn.c)0
-rw-r--r--libc/string/string.c (renamed from libc-0.0.4/string/string.c)0
-rw-r--r--libc/string/string.h (renamed from libc-0.0.4/include/string.h)1
-rw-r--r--libc/string/strncasecmp.c (renamed from libc-0.0.4/string/strncasecmp.c)0
-rw-r--r--libc/string/strpbrk.c (renamed from libc-0.0.4/string/strpbrk.c)0
-rw-r--r--libc/string/strsep.c (renamed from libc-0.0.4/string/strsep.c)0
-rw-r--r--libc/string/strspn.c (renamed from libc-0.0.4/string/strspn.c)0
-rw-r--r--libc/string/strstr.c (renamed from libc-0.0.4/string/strstr.c)0
-rw-r--r--libc/string/strtok.c (renamed from libc-0.0.4/string/strtok.c)0
-rw-r--r--libc/syscall/Config (renamed from libc-0.0.4/syscall/Config)0
-rw-r--r--libc/syscall/Makefile (renamed from libc-0.0.4/syscall/Makefile)13
-rw-r--r--libc/syscall/TODO (renamed from libc-0.0.4/syscall/TODO)0
-rw-r--r--libc/syscall/dirent.c (renamed from libc-0.0.4/syscall/dirent.c)2
-rw-r--r--libc/syscall/execve.c (renamed from libc-0.0.4/syscall/execve.c)0
-rw-r--r--libc/syscall/getinfo.c (renamed from libc-0.0.4/syscall/getinfo.c)0
-rw-r--r--libc/syscall/mksyscall (renamed from libc-0.0.4/syscall/mksyscall)5
-rw-r--r--libc/syscall/setjmp.c (renamed from libc-0.0.4/syscall/setjmp.c)0
-rw-r--r--libc/syscall/signal.c (renamed from libc-0.0.4/syscall/signal.c)0
-rw-r--r--libc/syscall/syscall.dat (renamed from libc-0.0.4/syscall/syscall.dat)15
-rw-r--r--libc/syscall/syslibc.c (renamed from libc-0.0.4/syscall/syslibc.c)0
-rw-r--r--libc/termios/Config (renamed from libc-0.0.4/termios/Config)0
-rw-r--r--libc/termios/Makefile (renamed from libc-0.0.4/termios/Makefile)15
-rw-r--r--libc/termios/README (renamed from libc-0.0.4/termios/README)0
-rw-r--r--libc/termios/termios.c (renamed from libc-0.0.4/termios/termios.c)43
-rw-r--r--libc/termios/ttyname.c45
-rw-r--r--libc/tests/Config (renamed from libc-0.0.4/tests/Config)0
-rw-r--r--libc/tests/Makefile (renamed from libc-0.0.4/tests/makefile)3
-rw-r--r--libc/tests/README (renamed from libc-0.0.4/tests/README)0
-rw-r--r--libc/tests/Real_make (renamed from libc-0.0.4/tests/Real_make)0
-rw-r--r--libc/tests/compr.c (renamed from libc-0.0.4/tests/compr.c)0
-rw-r--r--libc/tests/env.c (renamed from libc-0.0.4/tests/env.c)0
-rw-r--r--libc/tests/ft.c (renamed from libc-0.0.4/tests/ft.c)0
-rwxr-xr-xlibc/tests/grab.c (renamed from libc-0.0.4/tests/grab.c)0
-rw-r--r--libc/tests/hd.c (renamed from libc-0.0.4/tests/hd.c)0
-rw-r--r--libc/tests/line2.c (renamed from libc-0.0.4/tests/line2.c)0
-rw-r--r--libc/tests/lines.c (renamed from libc-0.0.4/tests/lines.c)0
-rwxr-xr-xlibc/tests/ls.c (renamed from libc-0.0.4/tests/ls.c)0
-rw-r--r--libc/tests/ouch.c (renamed from libc-0.0.4/tests/ouch.c)0
-rw-r--r--libc/tests/rand.c (renamed from libc-0.0.4/tests/rand.c)0
-rw-r--r--libc/tests/size.c (renamed from libc-0.0.4/tests/size.c)0
-rw-r--r--libc/tests/sync.c (renamed from libc-0.0.4/tests/sync.c)0
-rw-r--r--libc/tests/ucomp.c (renamed from libc-0.0.4/tests/ucomp.c)0
-rw-r--r--libc/tests/wc.c (renamed from libc-0.0.4/tests/wc.c)0
-rw-r--r--libc/utmp/Makefile24
-rw-r--r--libc/utmp/utent.c152
271 files changed, 2626 insertions, 1202 deletions
diff --git a/Libc_version b/Libc_version
index 81340c7..bbdeab6 100644
--- a/Libc_version
+++ b/Libc_version
@@ -1 +1 @@
-0.0.4
+0.0.5
diff --git a/Make.defs b/Make.defs
index 0297154..36d6edf 100644
--- a/Make.defs
+++ b/Make.defs
@@ -9,8 +9,8 @@ WALL=-Wno-comment
CCFLAGS =-Wall $(WALL) -O2 -fno-strength-reduce
LDFLAGS =-s
-BCCHOME =/usr/bcc
-LIBDIR =$(BCCHOME)/lib/bcc
-BINDIR =/usr/bin
+export BCCHOME =/usr/bcc
+export LIBDIR =$(BCCHOME)/lib/bcc
+export BINDIR =/usr/bin
CC =gcc
CFLAGS =$(CCFLAGS)
diff --git a/Makefile b/Makefile
index b47ed39..eaba6e1 100644
--- a/Makefile
+++ b/Makefile
@@ -8,7 +8,7 @@ TESTDIRS= tests dis88
DISTFILES=Makefile Make.defs README README.ash Libc_version
DISTDIRS= elksemu $(TESTDIRS)
-default:
+default: dummy
@echo You have to do make install as root
@echo Or:
@echo
@@ -21,6 +21,9 @@ default:
@echo 'make tests'
@echo
+dummy:
+ @if [ -f .runme ] ; then sh .runme ; rm .runme ; fi
+
install: install-bcc install-lib install-emu tests
bcc: dummy
@@ -40,7 +43,7 @@ tests: dummy
( echo 'Must do "make install-lib" first' && exit 1 )
@for i in $(TESTDIRS) ; do make -C $$i || exit 1; done
-library: link_libc
+library: dummy
@test -f $(BINDIR)/bcc -a -f $(LIBDIR)/ld86 || \
( echo 'Must do "make install-bcc" first' && exit 1 )
make -C libc
@@ -53,30 +56,35 @@ elksemu: dummy
install-bcc: dummy
@for i in $(PARTS) ; do make -C $$i install || exit 1; done
-install-lib: link_libc
+install-lib: dummy
@test -f $(BINDIR)/bcc -a -f $(LIBDIR)/ld86 || \
( echo 'Must do "make install-bcc" first' && exit 1 )
make -C libc install
+install-lib2: dummy
+ @test -f $(BINDIR)/bcc -a -f $(LIBDIR)/ld86 || \
+ ( echo 'Must do "make install-bcc" first' && exit 1 )
+ make -s -C libc clean
+ make -s -C libc PLATFORM=i86-FAST install
+ make -s -C libc clean
+ make -s -C libc PLATFORM=i86-DOS install
+ make -s -C libc clean
+
install-emu: dummy
@test -f libc/syscall/call_tab.v || \
( echo 'Must do "make library" first' && exit 1 )
make -C elksemu install
-link_libc: dummy
- @if [ -f Libc_version ] ; then \
- rm -f libc ; ln -fs libc-`cat Libc_version` libc ; fi
-
distribution: clean_rest
- -rm -f libc
make -C libc dist_ver
- tar xzf libc-8086-`cat Libc_version`.tar.gz
- tar cf /tmp/Development.tar $(DISTFILES) $(PARTS) $(DISTDIRS) \
- libc-`cat Libc_version`
- rm -rf libc-`cat Libc_version` Libc_version
+ tar cf /tmp/Development.tar $(DISTFILES) $(PARTS) $(DISTDIRS)
rm -rf /tmp/linux-86
mkdir /tmp/linux-86
- (cd /tmp/linux-86 ; tar xf ../Development.tar ; rm ../Development.tar)
- (cd /tmp; tar czf Development.tar.gz linux-86 ; rm -rf linux-86)
+ ln -s `pwd`/libc-8086-`cat Libc_version`.tar.gz /tmp/libc-8086.tgz
+ cd /tmp/linux-86 ; tar xzf ../libc-8086.tgz ; rm ../libc-8086.tgz
+ mv /tmp/linux-86/libc-`cat Libc_version` /tmp/linux-86/libc
+ cd /tmp/linux-86 ; tar xf ../Development.tar ; rm ../Development.tar
+ cd /tmp; tar czf Development.tar.gz linux-86 ; rm -rf linux-86
+ mv /tmp/Development.tar.gz /tmp/Dev86-`cat Libc_version`.tar.gz
+ rm -rf libc-`cat Libc_version` Libc_version
-dummy:
diff --git a/README b/README
index d117a44..49f3b3c 100644
--- a/README
+++ b/README
@@ -17,6 +17,10 @@ Once this is done new files will be /lib/elksemu, /usr/bcc/* and /usr/bin/bcc
The bcc command defaults to using /usr/bcc/include and /usr/bcc/lib. Beware
that /usr/bcc/include is a symlink into this directory.
+It is now also possible to make libc.a versions for MSDOS and a more compact
+version with 'CALLER_SAVES' and 'FIRST_ARG_IN_AX'. "Make install-lib2" does
+this and 'bcc -Md x.c -o x.com" or "bcc x.c -Mf x.c -o x" uses the libs.
+
The as86 and ld86 with this are _different_ from the ones needed for the
linux-i386 kernel but can replace them, the kernel-i386 ones _will_ _not_
work correctly here!
diff --git a/README.ash b/README.ash
index 7c84985..477855b 100644
--- a/README.ash
+++ b/README.ash
@@ -1,7 +1,7 @@
Building /bin/ash
After doing make install for 'bcc' unpack ash-linux-0.2.tar.gz; within this
-rename builtins to builtings.in then patch with this patchfile.
+rename builtins to builtins.in then patch with this patchfile.
You'll also need to turn on 'JOBS' on line 58 of shell.h when libc can
provide the functions.
diff --git a/bcc/Makefile b/bcc/Makefile
index eec2f83..9cc0f0a 100644
--- a/bcc/Makefile
+++ b/bcc/Makefile
@@ -9,7 +9,8 @@ include $(TOPDIR)/Make.defs
BCCDEFS=-DLOCALPREFIX="\"$(BCCHOME)\"" -DDEFARCH=0
else
CC=bcc
-LDFLAGS=-s
+CFLAGS=-Mf
+LDFLAGS=-s -M
endif
OBJS = bcc-cc1.o codefrag.o debug.o declare.o express.o exptree.o floatop.o \
diff --git a/bcc/bcc.c b/bcc/bcc.c
index 810cbcb..265553b 100644
--- a/bcc/bcc.c
+++ b/bcc/bcc.c
@@ -190,6 +190,7 @@ char **argv;
#ifdef BCC86
char *crt0;
#endif
+ char *libc = "-lc";
bool_T debug = FALSE;
bool_T echo = FALSE;
unsigned errcount = 0;
@@ -349,6 +350,24 @@ char **argv;
case 'L':
addarg(&ldargs, arg);
break;
+ case 'M':
+ switch(arg[2])
+ {
+ case 'd': /* DOS compile */
+#ifndef CCC
+ addarg(&ccargs, "-D__MSDOS__");
+#endif
+ addarg(&cppargs, "-D__MSDOS__");
+ addarg(&ldargs, "-d");
+ libc= "-ldos";
+ break;
+ case 'f': /* Caller saves+ax is first arg */
+ libc= "-lc_f";
+ addarg(&ccargs, "-f");
+ addarg(&ccargs, "-c");
+ break;
+ }
+ break;
case 'P':
addarg(&cppargs, arg + 2);
break;
@@ -642,7 +661,7 @@ char **argv;
else
#endif
{
- addarg(&ldargs, "-lc");
+ addarg(&ldargs, libc);
run((char *) NUL_PTR, f_out, &ldargs);
}
}
diff --git a/dis88/Makefile b/dis88/Makefile
index 692326f..f0b7a05 100644
--- a/dis88/Makefile
+++ b/dis88/Makefile
@@ -40,12 +40,10 @@ install: /usr/bin/dis88
/usr/bin/dis88: dis88
install -cs -o bin dis88 $@
-disrel.o: disrel.c
-dismain.o: dismain.c dis.h
-distabs.o: distabs.c dis.h
-dishand.o: dishand.c dis.h
-disfp.o: disfp.c dis.h
+$(OBJ): dis.h a.out.h
+a.out.h:
+ ln -s ../libc/include/a.out.h .
clean:
- rm -f *.bak *.o core dis88
+ rm -f *.bak *.o core dis88 a.out.h
diff --git a/dis88/a.out.h b/dis88/a.out.h
deleted file mode 120000
index ccbf4b5..0000000
--- a/dis88/a.out.h
+++ /dev/null
@@ -1 +0,0 @@
-../libc/include/a.out.h \ No newline at end of file
diff --git a/libc-0.0.4/include/linuxmt b/libc-0.0.4/include/linuxmt
deleted file mode 120000
index 45fae66..0000000
--- a/libc-0.0.4/include/linuxmt
+++ /dev/null
@@ -1 +0,0 @@
-../kinclude/linuxmt \ No newline at end of file
diff --git a/libc-0.0.4/include/utmp.h b/libc-0.0.4/include/utmp.h
deleted file mode 100644
index ca630a3..0000000
--- a/libc-0.0.4/include/utmp.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/* utmp.h <ndf@linux.mit.edu> */
-
-#ifndef __UTMP_H
-#define __UTMP_H
-
-#include <features.h>
-#include <sys/types.h>
-#include <paths.h>
-#include <time.h>
-
-#define UT_UNKNOWN 0
-#define UT_LINESIZE 12
-#define UT_NAMESIZE 8
-#define UT_HOSTSIZE 16
-
-#define RUN_LVL 1
-#define BOOT_TIME 2
-#define NEW_TIME 3
-#define OLD_TIME 4
-
-#define INIT_PROCESS 5
-#define LOGIN_PROCESS 6
-#define USER_PROCESS 7
-#define DEAD_PROCESS 8
-
-struct utmp
-{
- short ut_type; /* type of login */
- pid_t ut_pid; /* pid of login-process */
- char ut_line[UT_LINESIZE]; /* devicename of tty -"/dev/", null-term */
- char ut_id[2]; /* abbrev. ttyname, as 01, s1 etc. */
- time_t ut_time; /* logintime */
- char ut_user[UT_NAMESIZE]; /* username, not null-term */
- char ut_host[UT_HOSTSIZE]; /* hostname for remote login... */
- long ut_addr; /* IP addr of remote host */
-
-};
-
-extern void setutent __P ((void));
-extern void utmpname __P ((__const char *));
-extern struct utmp *getutent __P ((void));
-extern struct utmp *getutid __P ((struct utmp *));
-extern struct utmp *getutline __P ((struct utmp *));
-extern void pututline __P ((struct utmp *));
-extern struct utmp *_getutline __P ((struct utmp *));
-extern void endutent __P ((void));
-
-#endif /* __UTMP_H */
diff --git a/libc-0.0.4/pwd/__getpwent.c b/libc-0.0.4/pwd/__getpwent.c
deleted file mode 100644
index 1dfc87e..0000000
--- a/libc-0.0.4/pwd/__getpwent.c
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
- * __getpwent.c - This file is part of the libc-8086/pwd package for ELKS,
- * Copyright (C) 1995, 1996 Nat Friedman <ndf@linux.mit.edu>.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- */
-
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <fcntl.h>
-#include <pwd.h>
-
-#define __PWD_LINE_BUFFER_SIZE 256
-
-struct passwd *
-__getpwent(int passwd_fd)
-{
- static char pwd_line[__PWD_LINE_BUFFER_SIZE];
- unsigned short curr_index;
-
- /* field_num is the current field number, 0 through 6 */
- unsigned short field_num;
-
- /* field_length is the length of the current field */
- unsigned short field_length;
-
- /* field_begin is a pointer to the first character of the current field */
- char * field_begin;
-
- /* endptr is used to error-check the call to strtol() */
- char * endptr;
-
- /* the only static passwd structure. we return a pointer to it */
- static struct passwd passwd;
-
- /* Gross, but small... */
- goto readline_start;
-
-readline_restart:
- /* Advance to the end of the line */
- while (pwd_line[curr_index]!='\n' &&
- read(passwd_fd, &pwd_line[curr_index], 1)==1);
-
-readline_start:
- /* Initialize ourselves at the beginning of the line */
- curr_index=field_num=field_length=0;
- field_begin=pwd_line;
- while (read(passwd_fd, &pwd_line[curr_index], 1)==1)
- {
- if (curr_index==0)
- if (*pwd_line=='#' || *pwd_line==' ' || *pwd_line=='\n' ||
- *pwd_line=='\t')
- goto readline_restart;
-
- field_length++;
- if (pwd_line[curr_index]==':' || pwd_line[curr_index]=='\n')
- {
- pwd_line[curr_index]='\0';
- switch (field_num)
- {
- case 0: /* login */
- passwd.pw_name=field_begin;
- break;
- case 1: /* passwd */
- passwd.pw_passwd=field_begin;
- break;
- case 2: /* GID */
- case 3: /* UID */
- if (field_num==2)
- passwd.pw_uid=strtol(field_begin, &endptr, 10);
- else
- passwd.pw_gid=strtol(field_begin, &endptr, 10);
- if (endptr!=(pwd_line+curr_index)) /* there were invalid
- characters */
- goto readline_restart;
-
- curr_index-=field_length;
- break;
- case 4: /* GECOS field */
- passwd.pw_gecos=field_begin;
- break;
- case 5: /* home directory */
- passwd.pw_dir=field_begin;
- break;
- case 6: /* shell */
- passwd.pw_shell=field_begin;
- return &passwd;
- break;
- default: /* too many fields -- invalid line */
- goto readline_restart;
- }
- if (field_num!=2 && field_num!=3)
- field_begin=pwd_line+curr_index+1;
- field_num++;
- field_length=0;
- }
- curr_index++;
- if (curr_index>=__PWD_LINE_BUFFER_SIZE)
- {
- if (field_num<=3)
- goto readline_start;
-
- if (*passwd.pw_gecos)
- {
- if (field_num==4) /* gecos.. least important */
- {
- /* erase this field */
- curr_index-=field_length;
- field_num++;
- passwd.pw_gecos=field_begin-1;
- /* read until the next delimiter */
- while ((read(passwd_fd, &pwd_line[curr_index], 1)==1) &&
- pwd_line[curr_index]!=':');
-
- }
- else if (field_num>4) /* move everything back to the gecos... */
- {
- unsigned short shift;
- if (field_num==5)
- passwd.pw_dir=field_begin;
-
- shift=passwd.pw_dir-passwd.pw_gecos;
- memcpy(passwd.pw_gecos,
- passwd.pw_dir, pwd_line+curr_index-passwd.pw_dir);
- passwd.pw_gecos--;
- passwd.pw_dir=passwd.pw_gecos;
- field_begin-=shift;
- passwd.pw_shell-=shift;
- curr_index-=shift;
- }
- }
- else
- goto readline_restart;
- }
- }
- return NULL;
-}
-
diff --git a/libc-0.0.4/pwd/test_pwd b/libc-0.0.4/pwd/test_pwd
deleted file mode 100755
index bac2f1e..0000000
--- a/libc-0.0.4/pwd/test_pwd
+++ /dev/null
Binary files differ
diff --git a/libc-0.0.4/stdio1/libc.a b/libc-0.0.4/stdio1/libc.a
deleted file mode 100644
index e69de29..0000000
--- a/libc-0.0.4/stdio1/libc.a
+++ /dev/null
diff --git a/libc-0.0.4/stdio2/Funcs b/libc-0.0.4/stdio2/Funcs
deleted file mode 100644
index a177893..0000000
--- a/libc-0.0.4/stdio2/Funcs
+++ /dev/null
@@ -1,43 +0,0 @@
-+clearerr Stdio
-+fclose Stdio
-+fdopen Stdio
-+feof Stdio
-+ferror Stdio
-+fflush Stdio
-+fgetc Stdio
-+fgets Stdio
-+fileno Stdio
-+fopen Stdio
-+fprintf Stdio
-+fputc Stdio
-+fputs Stdio
-+fread Stdio
-+freopen Stdio
-+fscanf Stdio
-+fseek Stdio
-+ftell Stdio
-+fwrite Stdio
-+getc Stdio
-+getchar Stdio
-+gets Stdio
-+pclose Stdio Popen
-+popen Stdio Popen
-+printf Stdio
-+putc Stdio
-+putchar Stdio
-+puts Stdio
-+rewind Stdio
-+scanf Stdio
-+setbuf Stdio
-+setbuffer Stdio
-+sprintf Stdio
-+sscanf Stdio
-+ungetc Stdio
-+vfprintf Stdio
-+vfscanf Stdio
-+vprintf Stdio
-+vscanf Stdio
-+vsprintf Stdio
-+vsscanf Stdio
-setlinebuf Stdio
-setvbuf Stdio
diff --git a/libc-0.0.4/stdio2/stdio.c.old b/libc-0.0.4/stdio2/stdio.c.old
deleted file mode 100644
index 2c06b8d..0000000
--- a/libc-0.0.4/stdio2/stdio.c.old
+++ /dev/null
@@ -1,730 +0,0 @@
-/* Copyright (C) 1996 Robert de Bath <rdebath@cix.compulink.co.uk>
- * This file is part of the Linux-8086 C library and is distributed
- * under the GNU Library General Public License.
- */
-
-/* This is an implementation of the C standard IO package.
- */
-
-#include <stdio.h>
-
-#include <fcntl.h>
-#include <sys/types.h>
-#include <malloc.h>
-#include <errno.h>
-
-extern FILE *__IO_list; /* For fflush at exit */
-
-#ifndef __AS386_16__
-#define Inline_init __io_init_vars()
-#else
-#define Inline_init
-#endif
-
-#ifdef L__stdio_init
-
-FILE *__IO_list = 0; /* For fflush at exit */
-
-static char bufin[BUFSIZ];
-static char bufout[BUFSIZ];
-
-#define buferr (stderr->unbuf) /* Stderr is unbuffered */
-
-FILE stdin[1] =
-{
- {bufin, bufin, bufin, bufin, bufin + sizeof(bufin),
- 0, _IOFBF | __MODE_READ | __MODE_IOTRAN}
-};
-
-FILE stdout[1] =
-{
- {bufout, bufout, bufout, bufout, bufout + sizeof(bufout),
- 1, _IOFBF | __MODE_WRITE | __MODE_IOTRAN}
-};
-
-FILE stderr[1] =
-{
- {buferr, buferr, buferr, buferr, buferr + sizeof(buferr),
- 2, _IONBF | __MODE_WRITE | __MODE_IOTRAN}
-};
-
-/* Call the stdio initiliser; it's main job it to call atexit */
-
-#ifndef __AS386_16__
-#define STATIC
-#else
-#define STATIC static
-
-#asm
- loc 1 ! Make sure the pointer is in the correct segment
-auto_func: ! Label for bcc -M to work.
- .word ___io_init_vars ! Pointer to the autorun function
- .word no_op ! Space filler cause segs are padded to 4 bytes.
- .text ! So the function after is also in the correct seg.
-#endasm
-#endif
-
-STATIC int
-__stdio_close_all()
-{
- FILE *fp;
- fflush(stdout);
- fflush(stderr);
- for (fp = __IO_list; fp; fp = fp->next)
- {
- fflush(fp);
- close(fp->fd);
- /* Note we're not de-allocating the memory */
- /* There doesn't seem to be much point :-) */
- fp->fd = -1;
- }
-}
-
-STATIC void
-__io_init_vars()
-{
-#ifndef __AS386_16__
- static int first_time = 1;
- if( !first_time ) return ; first_time = 1;
-#endif
- if (isatty(1))
- stdout->mode |= _IOLBF;
- atexit(__stdio_close_all);
-}
-#endif
-
-#ifdef L_fputc
-int
-fputc(ch, fp)
-int ch;
-FILE *fp;
-{
- register int v;
- Inline_init;
-
- v = fp->mode;
- /* If last op was a read ... */
- if ((v & __MODE_READING) && fflush(fp))
- return EOF;
-
- /* Can't write or there's been an EOF or error then return EOF */
- if ((v & (__MODE_WRITE | __MODE_EOF | __MODE_ERR)) != __MODE_WRITE)
- return EOF;
-
- /* In MSDOS translation mode */
-#if __MODE_IOTRAN
- if (ch == '\n' && (v & __MODE_IOTRAN) && fputc('\r', fp) == EOF)
- return EOF;
-#endif
-
- /* Buffer is full */
- if (fp->bufpos >= fp->bufend && fflush(fp))
- return EOF;
-
- /* Right! Do it! */
- *(fp->bufpos++) = ch;
- fp->mode |= __MODE_WRITING;
-
- /* Unbuffered or Line buffered and end of line */
- if (((ch == '\n' && (v & _IOLBF)) || (v & _IONBF))
- && fflush(fp))
- return EOF;
-
- /* Can the macro handle this by itself ? */
- if (v & (__MODE_IOTRAN | _IOLBF | _IONBF))
- fp->bufwrite = fp->bufstart; /* Nope */
- else
- fp->bufwrite = fp->bufend; /* Yup */
-
- /* Correct return val */
- return (unsigned char) ch;
-}
-#endif
-
-#ifdef L_fgetc
-int
-fgetc(fp)
-FILE *fp;
-{
- int ch;
-
- if (fp->mode & __MODE_WRITING)
- fflush(fp);
-
- try_again:
- /* Can't read or there's been an EOF or error then return EOF */
- if ((fp->mode & (__MODE_READ | __MODE_EOF | __MODE_ERR)) != __MODE_READ)
- return EOF;
-
- /* Nothing in the buffer - fill it up */
- if (fp->bufpos >= fp->bufread)
- {
- fp->bufpos = fp->bufread = fp->bufstart;
- ch = fread(fp->bufpos, 1, fp->bufend - fp->bufstart, fp);
- if (ch == 0)
- return EOF;
- fp->bufread += ch;
- fp->mode |= __MODE_READING;
- fp->mode &= ~__MODE_UNGOT;
- }
- ch = *(fp->bufpos++);
-
-#if __MODE_IOTRAN
- /* In MSDOS translation mode; WARN: Doesn't work with UNIX macro */
- if (ch == '\r' && (fp->mode & __MODE_IOTRAN))
- goto try_again;
-#endif
-
- return ch;
-}
-#endif
-
-#ifdef L_fflush
-int
-fflush(fp)
-FILE *fp;
-{
- int len, cc;
- if (fp == NULL) /* On NULL flush the lot. */
- {
- if (fflush(stdin))
- return EOF;
- if (fflush(stdout))
- return EOF;
- if (fflush(stderr))
- return EOF;
-
- for (fp = __IO_list; fp; fp = fp->next)
- if (fflush(fp))
- return EOF;
-
- return 0;
- }
-
- /* If there's output data pending */
- if (fp->mode & __MODE_WRITING)
- {
- len = fp->bufpos - fp->bufstart;
-
- if (len)
- {
- /*
- * The loop is so we don't get upset by signals
- */
- do
- {
- cc = write(fp->fd, fp->bufstart, len);
- }
- while (cc == -1 && errno == EINTR);
- /*
- * I think the following test is _too_ stringent, but it's not
- * serious If it is found to be a problem then if cc>0 we can do
- * a memcpy to put the buffer in a state for a retry. Or even do
- * the retry ourselves.
- */
- if (cc != len)
- {
- fp->mode |= __MODE_ERR;
- return EOF;
- }
- }
- }
- /* If there's data in the buffer sychronise the file positions */
- else if (fp->mode & __MODE_READING)
- {
- /* Humm, I think this means sync the file like fpurge() ... */
- /* Anyway the user isn't supposed to call this function when reading */
-
- len = fp->bufread - fp->bufpos; /* Bytes buffered but unread */
- /* If it's a file, make it good */
- if (len > 0 && lseek(fp->fd, -len, 1) < 0)
- {
- /* Hummm - Not certain here, I don't think this is reported */
- /*
- * fp->mode |= __MODE_ERR; return EOF;
- */
- }
- }
-
- /* All done, no problem */
- fp->mode &= (~(__MODE_READING|__MODE_WRITING|__MODE_EOF|__MODE_UNGOT));
- fp->bufread = fp->bufwrite = fp->bufpos = fp->bufstart;
- return 0;
-}
-#endif
-
-#ifdef L_fgets
-/* Nothing special here ... */
-char *
-fgets(s, count, f)
-char *s;
-size_t count;
-FILE *f;
-{
- char *ret;
- register size_t i;
- register int ch;
-
- ret = s;
- for (i = count; i > 0; i--)
- {
- ch = getc(f);
- if (ch == EOF)
- {
- if (s == ret)
- return 0;
- break;
- }
- *s++ = (char) ch;
- if (ch == '\n')
- break;
- }
- *s = 0;
-
- if (ferror(f))
- return 0;
- return ret;
-}
-#endif
-
-#ifdef L_gets
-char *
-gets(str) /* BAD function; DON'T use it! */
-char *str;
-{
- /* Auwlright it will work but of course _your_ program will crash */
- /* if it's given a too long line */
- register char *p = str;
- register int c;
-
- while (((c = getc(stdin)) != EOF) && (c != '\n'))
- *p++ = c;
- *p = '\0';
- return (((c == EOF) && (p == str)) ? NULL : str); /* NULL == EOF */
-}
-#endif
-
-#ifdef L_fputs
-int
-fputs(str, fp)
-char *str;
-FILE *fp;
-{
- register int n = 0;
- while (*str)
- {
- if (putc(*str++, fp) == EOF)
- return (EOF);
- ++n;
- }
- return (n);
-}
-#endif
-
-#ifdef L_puts
-int
-puts(str)
-char *str;
-{
- register int n;
-
- if (((n = fputs(str, stdout)) == EOF)
- || (putc('\n', stdout) == EOF))
- return (EOF);
- return (++n);
-}
-#endif
-
-#ifdef L_fread
-/*
- * fread will often be used to read in large chunks of data calling read()
- * directly can be a big win in this case. Beware also fgetc calls this
- * function to fill the buffer.
- *
- * This ignores __MODE__IOTRAN; probably exactly what you want. (It _is_ what
- * fgetc wants)
- */
-int
-fread(buf, size, nelm, fp)
-char *buf;
-int size;
-int nelm;
-FILE *fp;
-{
- int len, v;
- unsigned bytes, got = 0;
- Inline_init;
-
- v = fp->mode;
-
- /* Want to do this to bring the file pointer up to date */
- if (v & __MODE_WRITING)
- fflush(fp);
-
- /* Can't read or there's been an EOF or error then return zero */
- if ((v & (__MODE_READ | __MODE_EOF | __MODE_ERR)) != __MODE_READ)
- return 0;
-
- /* This could be long, doesn't seem much point tho */
- bytes = size * nelm;
-
- len = fp->bufread - fp->bufpos;
- if (len >= bytes) /* Enough buffered */
- {
- memcpy(buf, fp->bufpos, (unsigned) bytes);
- fp->bufpos += bytes;
- return bytes;
- }
- else if (len > 0) /* Some buffered */
- {
- memcpy(buf, fp->bufpos, len);
- got = len;
- }
-
- /* Need more; do it with a direct read */
- len = read(fp->fd, buf + got, (unsigned) (bytes - got));
-
- /* Possibly for now _or_ later */
- if (len < 0)
- {
- fp->mode |= __MODE_ERR;
- len = 0;
- }
- else if (len == 0)
- fp->mode |= __MODE_EOF;
-
- return (got + len) / size;
-}
-#endif
-
-#ifdef L_fwrite
-/*
- * Like fread, fwrite will often be used to write out large chunks of
- * data; calling write() directly can be a big win in this case.
- *
- * But first we check to see if there's space in the buffer.
- *
- * Again this ignores __MODE__IOTRAN.
- */
-int
-fwrite(buf, size, nelm, fp)
-char *buf;
-int size;
-int nelm;
-FILE *fp;
-{
- register int v;
- int len;
- unsigned bytes, put;
-
- v = fp->mode;
- /* If last op was a read ... */
- if ((v & __MODE_READING) && fflush(fp))
- return 0;
-
- /* Can't write or there's been an EOF or error then return 0 */
- if ((v & (__MODE_WRITE | __MODE_EOF | __MODE_ERR)) != __MODE_WRITE)
- return 0;
-
- /* This could be long, doesn't seem much point tho */
- bytes = size * nelm;
-
- len = fp->bufend - fp->bufpos;
-
- /* Flush the buffer if not enough room */
- if (bytes > len)
- if (fflush(fp))
- return 0;
-
- len = fp->bufend - fp->bufpos;
- if (bytes <= len) /* It'll fit in the buffer ? */
- {
- fp->mode |= __MODE_WRITING;
- memcpy(fp->bufpos, buf, bytes);
- fp->bufpos += bytes;
-
- /* If we're not fully buffered */
- if (v & (_IOLBF | _IONBF))
- fflush(fp);
-
- return nelm;
- }
- else
- /* Too big for the buffer */
- {
- put = write(fp->fd, buf, bytes);
- if (put < 0)
- {
- fp->mode |= __MODE_ERR;
- put = 0;
- }
- }
-
- return put / size;
-}
-#endif
-
-#ifdef L_rewind
-void
-rewind(fp)
-FILE * fp;
-{
- fseek(fp, (long)0, 0);
- clearerr(fp);
-}
-#endif
-
-#ifdef L_fseek
-int
-fseek(fp, offset, ref)
-FILE *fp;
-long offset;
-int ref;
-{
- /* Use fflush to sync the pointers */
- /*
- * TODO: if __MODE_READING and no ungetc ever done can just move
- * pointer
- */
-
- if (fflush(fp) == EOF)
- return EOF;
- if (lseek(fp->fd, offset, ref) < 0)
- return EOF;
- return 0;
-}
-#endif
-
-#ifdef L_ftell
-long ftell(fp)
-FILE * fp;
-{
- long rv;
- if (fflush(fp) == EOF)
- return EOF;
- return lseek(fp->fd, 0L, SEEK_CUR);
-}
-#endif
-
-#ifdef L_fopen
-/*
- * This Fopen is all three of fopen, fdopen and freopen. The macros in
- * stdio.h show the other names.
- */
-FILE *
-__fopen(fname, fd, fp, mode)
-char *fname;
-int fd;
-FILE *fp;
-char *mode;
-{
- int open_mode = 0;
-#ifdef __MSDOS__
- int fopen_mode = __MODE_IOTRAN; /* default to 'text' file on DOS */
-#else
- int fopen_mode = 0;
-#endif
- int nfd = -1;
- FILE *nfp = 0;
-
- /* If we've got an fp close the old one (freopen) */
- if (fp)
- {
- /* Careful, don't de-allocate it */
- fopen_mode |= (fp->mode & (__MODE_BUF | __MODE_FREEFIL | __MODE_FREEBUF));
- fp->mode &= ~(__MODE_FREEFIL | __MODE_FREEBUF);
- fclose(fp);
- }
-
- /* decode the new open mode */
- while (*mode)
- switch (*mode++)
- {
- case 'r':
- fopen_mode |= __MODE_READ;
- break;
- case 'w':
- fopen_mode |= __MODE_WRITE;
- open_mode = (O_CREAT | O_TRUNC);
- break;
- case 'a':
- fopen_mode |= __MODE_WRITE;
- open_mode = (O_CREAT | O_APPEND);
- break;
- case '+':
- fopen_mode |= __MODE_RDWR;
- break;
-#if __MODE_IOTRAN
- case 'b': /* Binary */
- fopen_mode &= ~__MODE_IOTRAN;
- break;
- case 't': /* Text */
- fopen_mode |= __MODE_IOTRAN;
- break;
-#endif
- }
-
- /* Add in the read/write options to mode for open() */
- switch (fopen_mode & (__MODE_READ | __MODE_WRITE))
- {
- case 0:
- return 0;
- case __MODE_READ:
- open_mode |= O_RDONLY;
- break;
- case __MODE_WRITE:
- open_mode |= O_WRONLY;
- break;
- default:
- open_mode |= O_RDWR;
- break;
- }
-
- /* Allocate the (FILE) before we do anything irreversable */
- if (fp == 0)
- {
- nfp = malloc(sizeof(FILE));
- if (nfp == 0)
- return 0;
- }
-
- /* Open the file itself */
- if (fname)
- nfd = fd = open(fname, open_mode, 0666);
- if (fd < 0) /* Grrrr */
- {
- if (nfp)
- free(nfp);
- return 0;
- }
-
- /* If this isn't freopen create a (FILE) and buffer for it */
- if (fp == 0)
- {
- fp = nfp;
- fp->next = __IO_list;
- __IO_list = fp;
-
- fp->mode = __MODE_FREEFIL;
- fp->bufstart = malloc(BUFSIZ);
- if (fp->bufstart == 0) /* Oops, no mem */
- { /* Humm, full buffering with a two(!) byte
- * buffer. */
- fp->bufstart = fp->unbuf;
- fp->bufend = fp->unbuf + sizeof(fp->unbuf);
- fp->mode |= _IOFBF;
- }
- else
- {
- fp->bufend = fp->bufstart + BUFSIZ;
- fp->mode |= (__MODE_FREEBUF | _IOFBF);
- }
- }
-
- /* Ok, file's ready clear the buffer and save important bits */
- fp->bufpos = fp->bufread = fp->bufwrite = fp->bufstart;
- fp->mode |= fopen_mode;
- fp->fd = fd;
-
- return fp;
-}
-#endif
-
-#ifdef L_fclose
-int
-fclose(fp)
-FILE *fp;
-{
- int rv = 0;
-
- if (fp == 0)
- {
- errno = EINVAL;
- return EOF;
- }
- if (fflush(fp))
- return EOF;
-
- if (close(fp->fd))
- rv = EOF;
- fp->fd = -1;
-
- if (fp->mode & __MODE_FREEBUF)
- {
- free(fp->bufstart);
- fp->mode &= ~__MODE_FREEBUF;
- fp->bufstart = fp->bufend = 0;
- }
-
- if (fp->mode & __MODE_FREEFIL)
- {
- FILE *prev = 0, *ptr;
- fp->mode = 0;
-
- for (ptr = __IO_list; ptr && ptr != fp; ptr = ptr->next)
- ;
- if (ptr == fp)
- {
- if (prev == 0)
- __IO_list = fp->next;
- else
- prev->next = fp->next;
- }
- free(fp);
- }
- else
- fp->mode = 0;
-
- return rv;
-}
-#endif
-
-#ifdef L_setbuffer
-void
-setbuffer(fp, buf, size)
-FILE * fp;
-char * buf;
-int size;
-{
- fflush(fp);
- if( fp->mode & __MODE_FREEBUF ) free(fp->bufstart);
- fp->mode &= ~(__MODE_FREEBUF|__MODE_BUF);
-
- if( buf == 0 )
- {
- fp->bufstart = fp->unbuf;
- fp->bufend = fp->unbuf + sizeof(fp->unbuf);
- fp->mode |= _IONBF;
- }
- else
- {
- fp->bufstart = buf;
- fp->bufend = buf+size;
- fp->mode |= _IOFBF;
- }
- fp->bufpos = fp->bufread = fp->bufwrite = fp->bufstart;
-}
-#endif
-
-#ifdef L_ungetc
-int
-ungetc(c, fp)
-int c;
-FILE *fp;
-{
- if (fp->mode & __MODE_WRITING)
- fflush(fp);
-
- /* Can't read or there's been an error then return EOF */
- if ((fp->mode & (__MODE_READ | __MODE_ERR)) != __MODE_READ)
- return EOF;
-
- if( fp->bufpos > fp->bufstart )
- return *--fp->bufpos = (unsigned char) c;
- else if( fp->bufread == fp->bufstart )
- return *fp->bufread++ = (unsigned char) c;
- else
- return EOF;
-}
-#endif
-
diff --git a/libc-0.0.4/COPYING b/libc/COPYING
index eb685a5..eb685a5 100644
--- a/libc-0.0.4/COPYING
+++ b/libc/COPYING
diff --git a/libc-0.0.4/Changes b/libc/Changes
index 8cd0a84..3066545 100644
--- a/libc-0.0.4/Changes
+++ b/libc/Changes
@@ -6,13 +6,16 @@ If you make any changes please put a little note here. -RDB
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+----- Mar 21 '96 - RDB
+Add -Md -Mf flags to bcc.c
+corrected oops on ../Makefile
+Changes to READMEs
----- Mar 18 '96 - RDB
Re-written to wetware storage "Robert must remember to fill in changes!"
Ok, there's now some makefiles in the directory above for creating an
environment with cleanup of bcc/as/ld makefiles and new home for bcc files.
My version of a standard I/O package has been added, I've split the
output libs for Linux-86 and MSDOS.
-(Now need small mod to bcc to accept '-d' as '-d -D__MSDOS__ -ldos')
A couple of functions (including reboot) added to elksemu.
----- Mar 3 '96 - RDB
open/close in doselks
diff --git a/libc/Config_sh b/libc/Config_sh
new file mode 100644
index 0000000..e27acaa
--- /dev/null
+++ b/libc/Config_sh
@@ -0,0 +1,141 @@
+#!/bin/sh -
+# Copyright (C) 1996 Robert de Bath <rdebath@cix.compulink.co.uk>
+# This file is part of the Linux-8086 C library and is distributed
+# under the GNU Library General Public License.
+
+main()
+{
+ rm -f .config.tmp
+ ALLON=no
+
+ if [ -f .config.lst ]
+ then grep '^[^:]*:+:' .config.lst > .config.tmp
+ if [ ! -s .config.tmp ]
+ then ALLON=yes
+ fi
+ else ALLON=yes
+ fi
+
+ egrep -v '^#|^$' /dev/null */[Cc]onfig | \
+ sed -e 's./.:.' -e 's/[ ]*:[ ]*/:/g' >> .config.tmp 2>/dev/null
+ ls */Makefile | sed 's-/Makefile-:+:+-' >> .config.tmp
+ sort .config.tmp > .config.lst
+
+ unset_dups
+
+ if [ ! -s .config.lst ]
+ then echo 'No configuration options'
+ exit 0
+ fi
+
+ CHANGED=0
+ RUNNING=1
+ while [ $RUNNING = 1 ]
+ do
+ display
+ echo
+ echo -n 'Option to flip [or quit] >'
+ read n
+ v=""
+ case "$n" in
+ [qQ]* ) RUNNING=0
+ ;;
+ [0-9] ) v=$n ;;
+ [0-9][0-9] ) v=$n ;;
+ * ) echo '\007'
+ ;;
+ esac
+
+ if [ "$v" != "" ]
+ then set_option $v
+ fi
+ done
+
+ if [ "$CHANGED" = 1 ]
+ then echo '
+ You should now run a "make realclean" to clean out the libc.a
+'
+ exit 1
+ fi
+
+ exit 0
+}
+
+display()
+{
+ clear
+ echo 'Configuration options'
+ echo
+ awk -F: < .config.lst '{
+ if( $3 == "+" ) next;
+ if( $2 == "+" ) { flags[$1] = 1; next; }
+
+ printf("%2d) ", ++count);
+ if( $1 in flags ) printf("(ON) ");
+ else printf("(OFF) ");
+ if( $2 == "Config" ) printf(" "); else printf("* ");
+ printf("%s\n", $4);
+ }'
+}
+
+unset_dups()
+{
+ awk -F: < .config.lst '{
+ if( $2 == "+" && $3 == "+") { if( noco[$1] != 1 ) noco[$1] = 2; next; }
+ if( $2 == "+" ) { flags[$1] = 1; next; }
+ if( "'$ALLON'" == "yes" && $2 == "Config" ) flags[$1] = 1;
+
+ if( $1 in flags )
+ {
+ if( $3 in gottype )
+ ;
+ else
+ {
+ printf("%s:+:\n", $1);
+ gottype[$3] = 1;
+ }
+ }
+ noco[$1] = 1;
+ printf("%s\n", $0);
+ } END {
+ for(i in noco)
+ if( noco[i] == 2 )
+ printf("%s:+:+\n", i);
+ }' | sort > .config.tmp
+ ALLON=no
+ mv -f .config.tmp .config.lst
+}
+
+set_option()
+{
+ rm -f .config.tmp1
+ awk -F: < .config.lst '{
+ if( $2 == "+" && $3 == "+" ) { print $0; next; }
+ if( $2 == "+" ) { flags[$1] = 1; next; }
+
+ if( ++cnt == '$1' )
+ {
+ if( $1 in flags )
+ ;
+ else
+ printf("%s:+:\n", $1) > ".config.tmp1";
+ printf("%s\n", $0) > ".config.tmp1";
+ }
+ else
+ {
+ if( $1 in flags )
+ printf("%s:+:\n", $1);
+ printf("%s\n", $0);
+ }
+ }' > .config.tmp2
+ if [ -f .config.tmp1 ]
+ then CHANGED=1
+ else echo 'Cannot change that option!'
+ sleep 2
+ fi
+ cat .config.tmp[12] > .config.lst
+ rm .config.tmp[12]
+ unset_dups
+}
+
+main
diff --git a/libc-0.0.4/Contributors b/libc/Contributors
index d96193d..27a3145 100644
--- a/libc-0.0.4/Contributors
+++ b/libc/Contributors
@@ -4,5 +4,5 @@ Chad Page <page0588@sundance.sjsu.edu>
Dale Schumacher <dal@syntel.UUCP>
Joel N. Weber II <nemo@koa.iolani.honolulu.hi.us>
Nat Friedman <ndf@aleph1.mit.edu>
-Robert de Bath <rdebath@cix.compulink.co.uk>
+Robert de Bath <robert@mayday.compulink.co.uk>
Steven Huang <sthuang@hns.com>
diff --git a/libc-0.0.4/KERNEL b/libc/KERNEL
index 6f83f90..6f83f90 100644
--- a/libc-0.0.4/KERNEL
+++ b/libc/KERNEL
diff --git a/libc-0.0.4/MAGIC b/libc/MAGIC
index 69c9c2d..69c9c2d 100644
--- a/libc-0.0.4/MAGIC
+++ b/libc/MAGIC
diff --git a/libc-0.0.4/Make.defs b/libc/Make.defs
index b960852..3cee160 100644
--- a/libc-0.0.4/Make.defs
+++ b/libc/Make.defs
@@ -11,13 +11,14 @@
# Define enviroment var for others.
ifeq ($(PLATFORM),)
PLATFORM=i86-ELKS
+#PLATFORM=i86-FAST
#PLATFORM=i86-DOS
#PLATFORM=i386-Linux
endif
VERMAJOR=0
VERMINOR=0
-VERPATCH=4
+VERPATCH=5
VER=$(VERMAJOR).$(VERMINOR).$(VERPATCH)
LIBDEFS=-D__LIBC__
@@ -28,14 +29,17 @@ ifneq ($(PLATFORM),i386-Linux)
# Normal standard 8086 code
ifeq ($(PLATFORM),i86-ELKS)
ARCH=-0
+endif
# 8086 elks code With "Caller saves" and "First arg in AX"
-# ARCH=-0 -C-c -C-f
+ifeq ($(PLATFORM),i86-FAST)
+ARCH=-0 -Mf
+LIBC=libc_f.a
endif
# MSDOS COM file (msdos libs don't support "First arg in AX")
ifeq ($(PLATFORM),i86-DOS)
-ARCH=-0 -d -D__MSDOS__
+ARCH=-0 -Md
LIBC=libdos.a
endif
diff --git a/libc-0.0.4/Makefile b/libc/Makefile
index 7b233bd..41fd68d 100644
--- a/libc-0.0.4/Makefile
+++ b/libc/Makefile
@@ -9,10 +9,10 @@ SRC=crt0.c
OBJ=crt0.o
TARGETS=$(OBJ) $(LIBC)
-TXT=COPYING Changes Contributors MAGIC \
- Make.defs Makefile New_subdir Pre_main README TODO KERNEL
+TXT=Makefile Make.defs README TODO KERNEL COPYING Changes Contributors MAGIC \
+ New_subdir Pre_main Config_sh
-all: $(TARGETS)
+all: .config.lst $(TARGETS)
install: all
install -d $(BCCHOME)
@@ -26,30 +26,35 @@ install: all
tests: dummy
make -C tests
-$(LIBC): transfer
- for i in */Makefile ; do \
- make -C `dirname $$i` $@ || exit 1 ; \
+dummy:
+
+$(LIBC): .config.dir transfer
+ @for i in `cat .config.dir` ; do \
+ echo make -C $$i libc.a ; make -C $$i libc.a || exit 1 ; \
done
-realclean: clean
- rm -f $(OBJ) $(LIBC) libc-$(VER)
- @for i in */makefile ; do \
+realclean: dummy
+ rm -f $(OBJ) $(LIBC) .config.dir
+ @for i in */Makefile ; do \
grep -q '^clean:' $$i && make -C `dirname $$i` clean ; \
done ; echo -n
-clean: dummy
- for i in */Makefile ; do \
+clean: .config.dir
+ @for i in */Makefile ; do \
make -C `dirname $$i` $@ || exit 1 ; \
done
+.config.lst: Makefile Make.defs Config_sh
+ sh Config_sh
+
config:
- sh Config.sh
- @for i in */Makefile ; do \
- [ -f `dirname $$i`/Config.sh ] && \
- sh `dirname $$i`/Config.sh ] ; \
- done ; echo -n
+ sh Config_sh
+
+.config.dir: .config.lst
+ @grep '^[^:]*:+:' < .config.lst | sed 's/:.*//' > .config.dir
dist: clean
+ -rm -f include/linuxmt
tar cf temp.tar \
$(TXT) $(TARGETS) $(SRC) include \
`for i in */Makefile */Config; do dirname $$i; done | sort -u`
@@ -64,8 +69,6 @@ dist_ver: dist
transfer: dummy
@echo Checking for transfers
- @for i in */Makefile ; do \
- grep -q '^transfer' $$i && make -C `dirname $$i` $@ ; \
+ @for i in `cat .config.dir`; do \
+ grep -q '^transfer' $$i/Makefile && make -C $$i $@ ; \
done ; echo -n
-
-dummy:
diff --git a/libc-0.0.4/New_subdir b/libc/New_subdir
index a10ccf7..92f523d 100755
--- a/libc-0.0.4/New_subdir
+++ b/libc/New_subdir
@@ -36,11 +36,11 @@ OBJ=$1.o
all: \$(OBJ)
libc.a: \$(OBJ)
- ar r ../libc.a \$(OBJ)
+ ar r ../$(LIBC) \$(OBJ)
@touch libc.a
clean:
- rm -f \$(OBJ) libc.a
+ rm -f *.o libc.a
!
cat <<! > $1/README
Copyright (C) $YEAR $NAME <$EMAIL>
diff --git a/libc-0.0.4/Pre_main b/libc/Pre_main
index e3793f1..e3793f1 100644
--- a/libc-0.0.4/Pre_main
+++ b/libc/Pre_main
diff --git a/libc-0.0.4/README b/libc/README
index f8160ba..2b4bbdc 100644
--- a/libc-0.0.4/README
+++ b/libc/README
@@ -1,38 +1,52 @@
-This is the README for libc-8086-0.0.3.tar.gz
-Robert de Bath, 22/Feb/96, rdebath@cix.compulink.co.uk
-
-The lib is starting to look a lot fatter, it can now be compiled five
-different ways for Linux-8086 standard, Linux-8086 with 'First arg in AX',
-MS-DOS, BCC-386 or for GNU-386. At the moment the 386 versions are
-missing some _very_ important bits.
+This is the README for libc-8086-0.0.4.tar.gz
+Robert de Bath, 21/Mar/96, rdebath@cix.compulink.co.uk
+
+The lib is now positivly plump, there's a new standard IO package, passwd,
+group, utmp, crypt and lots of other pieces.
+
+The lib can be compiled five different ways for Linux-8086 standard,
+Linux-8086 with 'First arg in AX', MS-DOS, BCC-386 or for GNU-386. At
+the moment the 386 versions are missing some _very_ important bits.
+This can be done by running.
+ make PLATFORM=i86-FAST clean all
+ make PLATFORM=i86-DOS clean all
+an so on.
+
+SYSTEM CALLS
+The system call table (syscalls/syscall.dat) is constantly changing, using
+skewed versions is _very_ likely to give you segfaults and strange behaviour.
+For this lib you should use the same version of elksemu (0.0.4).
+The system call table will only be frozen when the linux-86 kernel is
+running and reasonably stable.
THE COMPILER
- You should use the newest version of the bcc/bcc-cc1/as86/ld86 tools these
- contain patches to ease operating in a cross-compiling enviroment and
- the arguments to BCC have changed slightly.
-
- The standard ld86 can't generate MSDOS COM files by itself.
- If you need to change search paths they can all be done from the command
- line or by recompiling _only_ bcc.c.
- These tools also contain Nat's 'clean' and 'ansi' patches.
+You should use the versions of bcc, unproto, as86, ld86 and elksemu that
+are in version 0.0.4 combined development environment. Some other
+versions will work but often they'll just appear to work or not work at
+all. The standard bcc-cc1 won't pickup the right header files, the
+standard ld86 won't generate COM files and looks in the wrong place for
+crt0.o and libc.a.
Main Subdirectories.
-include Some include files, some new others Glib or Glib hacked.
- (They are a _real_ mess ATM and very light on the ground)
-
bcc Lots of BCC helper functions
+error The C error functions.
+grp Routines for /etc/group, from Nat
+include Some include files, some new others Glib or Glib hacked.
+kinclude Kernel include files, here for now.
malloc1 My malloc routines
malloc2 Joel's malloc routines
misc Various larger functions
msdos This is the equlivent of the syscall directory for msdos.
-string The functions for string.h
-syscall All the system call functions, and a few tied lib ones.
-stdio Joel's standard I/O functions - as yet rather incomplete
pwd Routines for /etc/passwd, from Nat
-grp Routines for /etc/group, from Nat
regexp Standard regular expression parser
+stdio1 Joel's standard I/O functions - as yet rather incomplete
+stdio2 My standard I/O
+string The functions for string.h
+syscall All the system call functions, and a few tied lib ones.
+termios Termimal mode control.
+utmp /etc/utmp updating
tests Various C programs used to test the lib.
Directory structure:
@@ -55,16 +69,6 @@ Directory structure:
If you need to call something before main see the file 'Pre_main'.
-There are symlinks in the archive, they assume a layout something like:
-
- Linux_8086
- Linux_8086/libc This Libc
- Linux_8086/linuxmt The Elks Kernel
- Linux_8086/ELKSemu The Elks Emulator
- Linux_8086/bcc Compiler src
- Linux_8086/as Assembler
- Linux_8086/ld Linker
-
-Robert
-=*=- -=*=- -=*=- -=*=- -=*=- -=*=- -=*=- -=*=- -=*=- -=*=- -=*=- -=*=- -=*=-
diff --git a/libc-0.0.4/TODO b/libc/TODO
index a65fac7..83e1a4e 100644
--- a/libc-0.0.4/TODO
+++ b/libc/TODO
@@ -7,48 +7,49 @@ Add more to this todo list!
TODO for libc-8086:
Item Notes
---------------------------------------------------------------------------
-Floating Point - BUT note there may need to be kernel support. Also,
- BCC doesn't do it properly right now...
Header Files - This will take some time, also some files should
be kernel.
-Stdio - Joel is on this. (stdio1) (RDB stdio2)
+Floating Point - Bruce is on this (Yes that one) Initially it'll
+ assume an FPU is available. "int" version soon
+ after.
dirent &co - Directory listing - Partial.
-getgrent &co - Nat -Done
-getpwent &co - Nat -Done
-utmp/wtmp - Nat -Done
hsearch &co -
tsearch &co -
locale processing - multi national, unicode (string stuff has a couple
of stubs)
-login - getpass and friends - [I'll just dump the tiny-login
- getpass code in -Nat]
+login - getpass and friends - Some, rest soon.
rpc -
-setjmp - Done, Rob
syslog &co - make stubs to splatter to console.
-time calcs - mktime gmtime localtime etc
+time calcs - mktime gmtime localtime etc, Nat
timezone - Probably V simplistic, List of UTC's
offsets & STDvDST
+i386 support - For both GCC and BCC-386.
+
+Stdio - Joel is on this. (stdio1) (RDB stdio2)
+getgrent &co - Nat -Done
+getpwent &co - Nat -Done
+utmp/wtmp - Nat -Done
+setjmp - Done, Rob
shadow password - Do we need ? Do we want :-) [No! Ick! ;) -Nat]
termcap - and curses; what does ncurses need ? (150kb!!)
-crypt - glibc/crypt ? Use TEA?
+crypt - TEA version, first cut.
signal stuff - Got a basic 'signal' appears to work correctly.
getenv/setenv - Done
bsearch - Grabbed (Public Domain)
lsearch - Grabbed (Public Domain)
random numbers - Got ZX81 version (better than some) (And 2nd now)
-math - Until BCC can handle 16 bit FP properly, this is
- probably on hold..
-dual-platform build
-environment - This will be a gradual process, I imagine.
+Build environment - Good first cut is now available.
Other projects:
Project Notes
---------------------------------------------------------------------------
Optimiser for BCC - A lot of work, but lucrative.
+ (assembler level one started, by?)
Tiny vi editor - Use 'ae' ?
Shells: Bourne, Csh,
-menu, silly - ash with proper compile-time options. . . ?
+menu, silly - ash now compiles, Rob.
Tiny Perl - :-) :-) You first ;)
User commands - Everything in /bin /usr/bin - will existing PD/GPL
- compile in 16 bit ? Or do smaller ones exist,
- need to written ?
+ compile in 16 bit ? Or do smaller ones exist,
+ need to be written ?
+
diff --git a/libc-0.0.4/bcc/Config b/libc/bcc/Config
index 0bfed09..0bfed09 100644
--- a/libc-0.0.4/bcc/Config
+++ b/libc/bcc/Config
diff --git a/libc-0.0.4/bcc/Makefile b/libc/bcc/Makefile
index b5019a5..4f52133 100644
--- a/libc-0.0.4/bcc/Makefile
+++ b/libc/bcc/Makefile
@@ -50,9 +50,9 @@ $(ROBJ): $(RSRC)
$(POBJ): $(PSRC)
$(CC) $(CFLAGS) -c -DL_$* -o $@ $(PSRC)
-$(LIBC): $(OBJ)
+libc.a: $(OBJ)
ar r ../$(LIBC) $(OBJ)
@touch libc.a
clean:
- rm -f $(OBJ) libc.a
+ rm -f *.o libc.a
diff --git a/libc-0.0.4/bcc/__ldivmod.c b/libc/bcc/__ldivmod.c
index 4cb6d77..4cb6d77 100644
--- a/libc-0.0.4/bcc/__ldivmod.c
+++ b/libc/bcc/__ldivmod.c
diff --git a/libc-0.0.4/bcc/alloca.c b/libc/bcc/alloca.c
index 4f85047..4f85047 100644
--- a/libc-0.0.4/bcc/alloca.c
+++ b/libc/bcc/alloca.c
diff --git a/libc-0.0.4/bcc/bcc_bsw.c b/libc/bcc/bcc_bsw.c
index 4dd0d11..4dd0d11 100644
--- a/libc-0.0.4/bcc/bcc_bsw.c
+++ b/libc/bcc/bcc_bsw.c
diff --git a/libc-0.0.4/bcc/bcc_int.c b/libc/bcc/bcc_int.c
index abdb7b4..abdb7b4 100644
--- a/libc-0.0.4/bcc/bcc_int.c
+++ b/libc/bcc/bcc_int.c
diff --git a/libc-0.0.4/bcc/bcc_io.c b/libc/bcc/bcc_io.c
index af5dfd2..af5dfd2 100644
--- a/libc-0.0.4/bcc/bcc_io.c
+++ b/libc/bcc/bcc_io.c
diff --git a/libc-0.0.4/bcc/bcc_long.c b/libc/bcc/bcc_long.c
index 4b6ceae..4b6ceae 100644
--- a/libc-0.0.4/bcc/bcc_long.c
+++ b/libc/bcc/bcc_long.c
diff --git a/libc-0.0.4/bcc/heap.c b/libc/bcc/heap.c
index af4e898..af4e898 100644
--- a/libc-0.0.4/bcc/heap.c
+++ b/libc/bcc/heap.c
diff --git a/libc-0.0.4/crt0.c b/libc/crt0.c
index 71ca6bc..71ca6bc 100644
--- a/libc-0.0.4/crt0.c
+++ b/libc/crt0.c
diff --git a/libc-0.0.4/crt0.o b/libc/crt0.o
index e43705b..e43705b 100644
--- a/libc-0.0.4/crt0.o
+++ b/libc/crt0.o
Binary files differ
diff --git a/libc-0.0.4/error/Config b/libc/error/Config
index 1f384b7..1f384b7 100644
--- a/libc-0.0.4/error/Config
+++ b/libc/error/Config
diff --git a/libc-0.0.4/error/Makefile b/libc/error/Makefile
index 885f2b8..bcc9287 100644
--- a/libc-0.0.4/error/Makefile
+++ b/libc/error/Makefile
@@ -9,9 +9,9 @@ OBJ=error.o sys_errlist.o perror.o sys_siglist.o __assert.o
all: $(OBJ)
-$(LIBC): $(OBJ)
+libc.a: $(OBJ)
ar r ../$(LIBC) $(OBJ)
@touch libc.a
clean:
- rm -f $(OBJ) libc.a
+ rm -f *.o libc.a
diff --git a/libc-0.0.4/error/README b/libc/error/README
index 02c123f..02c123f 100644
--- a/libc-0.0.4/error/README
+++ b/libc/error/README
diff --git a/libc-0.0.4/error/__assert.c b/libc/error/__assert.c
index bcf04e8..bcf04e8 100644
--- a/libc-0.0.4/error/__assert.c
+++ b/libc/error/__assert.c
diff --git a/libc-0.0.4/error/error.c b/libc/error/error.c
index 3695719..3695719 100644
--- a/libc-0.0.4/error/error.c
+++ b/libc/error/error.c
diff --git a/libc-0.0.4/error/liberror.txt b/libc/error/liberror.txt
index 2b510bd..2b510bd 100644
--- a/libc-0.0.4/error/liberror.txt
+++ b/libc/error/liberror.txt
diff --git a/libc-0.0.4/error/perror.c b/libc/error/perror.c
index f9b0965..f9b0965 100644
--- a/libc-0.0.4/error/perror.c
+++ b/libc/error/perror.c
diff --git a/libc-0.0.4/error/sys_errlist.c b/libc/error/sys_errlist.c
index 1d9e65b..1d9e65b 100644
--- a/libc-0.0.4/error/sys_errlist.c
+++ b/libc/error/sys_errlist.c
diff --git a/libc-0.0.4/error/sys_siglist.c b/libc/error/sys_siglist.c
index 8f502f6..8f502f6 100644
--- a/libc-0.0.4/error/sys_siglist.c
+++ b/libc/error/sys_siglist.c
diff --git a/libc/grp/Config b/libc/grp/Config
new file mode 100644
index 0000000..9f49d93
--- /dev/null
+++ b/libc/grp/Config
@@ -0,0 +1 @@
+grp: /etc/group managment
diff --git a/libc-0.0.4/grp/Makefile b/libc/grp/Makefile
index 9c01e23..e8cb13a 100644
--- a/libc-0.0.4/grp/Makefile
+++ b/libc/grp/Makefile
@@ -20,7 +20,7 @@ all: $(GOBJ)
%.o: %.c config-grp.h
$(CC) $(CFLAGS) -o $@ $< -c
-$(LIBC): $(GOBJ)
+libc.a: $(GOBJ)
ar r ../$(LIBC) $(GOBJ)
@touch libc.a
@@ -34,7 +34,7 @@ libgrp.a: $(GOBJ)
ranlib libgrp.a
clean:
- rm -f $(GOBJ) libc.a libgrp.a
+ rm -f *.o libc.a libgrp.a
diff --git a/libc-0.0.4/grp/__getgrent.c b/libc/grp/__getgrent.c
index ed46163..612f112 100644
--- a/libc-0.0.4/grp/__getgrent.c
+++ b/libc/grp/__getgrent.c
@@ -21,13 +21,12 @@
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
-#include <malloc.h>
#include <grp.h>
-#include "config-grp.h"
+#include "config.h"
/*
* This is the core group-file read function. It behaves exactly like
- * getgrent() except that it is passed a file descriptor, and getgrent()
+ * getgrent() except that it is passed a file descriptor. getgrent()
* is just a wrapper for this function.
*/
struct group *
@@ -39,67 +38,68 @@ __getgrent(int grp_fd)
#else
static char * line_buff = NULL;
static char ** members = NULL;
+ short line_index;
+ short buff_size;
#endif
static struct group group;
register char * ptr;
char * field_begin;
- char * endptr;
short member_num;
- short line_index;
+ char * endptr;
+ int line_len;
/* We use the restart label to handle malformatted lines */
restart:
+#ifdef GR_SCALE_DYNAMIC
line_index=0;
+ buff_size=256;
+#endif
#ifndef GR_SCALE_DYNAMIC
- *line_buff='\0';
/* Read the line into the static buffer */
- while (1)
+ if ((line_len=read(grp_fd, line_buff, GR_MAX_LINE_LEN))<=0)
+ return NULL;
+ field_begin=strchr(line_buff, '\n');
+ if (field_begin!=NULL)
+ lseek(grp_fd, (long) (1+field_begin-(line_buff+line_len)), SEEK_CUR);
+ else /* The line is too long - skip it :-\ */
{
- if (read(grp_fd, &line_buff[line_index], 1)<=0)
+ do { if ((line_len=read(grp_fd, line_buff, GR_MAX_LINE_LEN))<=0)
return NULL;
- if (*line_buff=='#' || *line_buff==' ' || *line_buff=='\n' ||
- *line_buff=='\t')
- {
- while (line_buff[line_index]!='\n' &&
- read(grp_fd, &line_buff[line_index], 1)==1);
- goto restart;
- }
- if (line_buff[line_index]=='\n')
- {
- line_buff[line_index]='\0';
- break;
- }
- line_index++;
- if (line_index==GR_MAX_LINE_LEN)
- {
- while (line_buff[line_index]!='\n' &&
- read(grp_fd, &line_buff[line_index], 1)==1);
- return NULL;
- }
+ } while (!(field_begin=strchr(line_buff, '\n')));
+ lseek(grp_fd, (long) ((field_begin-line_buff)-line_len+1), SEEK_CUR);
+ goto restart;
}
-
+ if (*line_buff=='#' || *line_buff==' ' || *line_buff=='\n' ||
+ *line_buff=='\t')
+ goto restart;
+ *field_begin='\0';
+
#else /* !GR_SCALE_DYNAMIC */
- line_buff=realloc(line_buff, 1);
+ line_buff=realloc(line_buff, buff_size);
while (1)
{
- if (read(grp_fd, &line_buff[line_index], 1)<=0)
+ if ((line_len=read(grp_fd, line_buff+line_index,
+ buff_size-line_index))<=0)
return NULL;
- if (*line_buff=='#' || *line_buff==' ' || *line_buff=='\n' ||
- *line_buff=='\t')
+ field_begin=strchr(line_buff, '\n');
+ if (field_begin!=NULL)
{
- while (line_buff[line_index]!='\n' &&
- read(grp_fd, &line_buff[line_index], 1)==1);
- goto restart;
+ lseek(grp_fd, (long) (1+field_begin-(line_len+line_index+line_buff)),
+ SEEK_CUR);
+ *field_begin='\0';
+ if (*line_buff=='#' || *line_buff==' ' || *line_buff=='\n' ||
+ *line_buff=='\t')
+ goto restart;
+ break;
}
- if (line_buff[line_index]=='\n')
+ else /* Allocate some more space */
{
- line_buff[line_index]='\0';
- break;
+ line_index=buff_size;
+ buff_size+=256;
+ line_buff=realloc(line_buff, buff_size);
}
- line_index++;
- line_buff=realloc(line_buff, line_index+1);
}
#endif /* GR_SCALE_DYNAMIC */
diff --git a/libc-0.0.4/grp/config-grp.h b/libc/grp/config-grp.h
index 337d54b..337d54b 100644
--- a/libc-0.0.4/grp/config-grp.h
+++ b/libc/grp/config-grp.h
diff --git a/libc/grp/config.h b/libc/grp/config.h
new file mode 100644
index 0000000..337d54b
--- /dev/null
+++ b/libc/grp/config.h
@@ -0,0 +1,65 @@
+/*
+ * config-grp.h - This file is part of the libc-8086/grp package for ELKS,
+ * Copyright (C) 1995, 1996 Nat Friedman <ndf@linux.mit.edu>.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+
+#ifndef _CONFIG_GRP_H
+#define _CONFIG_GRP_H
+
+/*
+ * Define GR_SCALE_DYNAMIC if you want grp to dynamically scale its read buffer
+ * so that lines of any length can be used. On very very small systems,
+ * you may want to leave this undefined becasue it will make the grp functions
+ * somewhat larger (because of the inclusion of malloc and the code necessary).
+ * On larger systems, you will want to define this, because grp will _not_
+ * deal with long lines gracefully (they will be skipped).
+ */
+#define GR_SCALE_DYNAMIC
+
+#ifndef GR_SCALE_DYNAMIC
+/*
+ * If scaling is not dynamic, the buffers will be statically allocated, and
+ * maximums must be chosen. GR_MAX_LINE_LEN is the maximum number of
+ * characters per line in the group file. GR_MAX_MEMBERS is the maximum
+ * number of members of any given group.
+ */
+#define GR_MAX_LINE_LEN 128
+/* GR_MAX_MEMBERS = (GR_MAX_LINE_LEN-(24+3+6))/9 */
+#define GR_MAX_MEMBERS 11
+
+#endif /* !GR_SCALE_DYNAMIC */
+
+
+/*
+ * Define GR_DYNAMIC_GROUP_LIST to make initgroups() dynamically allocate
+ * space for it's GID array before calling setgroups(). This is probably
+ * unnecessary scalage, so it's undefined by default.
+ */
+#undef GR_DYNAMIC_GROUP_LIST
+
+#ifndef GR_DYNAMIC_GROUP_LIST
+/*
+ * GR_MAX_GROUPS is the size of the static array initgroups() uses for
+ * its static GID array if GR_DYNAMIC_GROUP_LIST isn't defined.
+ */
+#define GR_MAX_GROUPS 64
+
+#endif /* !GR_DYNAMIC_GROUP_LIST */
+
+#endif /* !_CONFIG_GRP_H */
diff --git a/libc-0.0.4/grp/fgetgrent.c b/libc/grp/fgetgrent.c
index 800236f..800236f 100644
--- a/libc-0.0.4/grp/fgetgrent.c
+++ b/libc/grp/fgetgrent.c
diff --git a/libc-0.0.4/grp/getgrgid.c b/libc/grp/getgrgid.c
index c1dd20e..c1dd20e 100644
--- a/libc-0.0.4/grp/getgrgid.c
+++ b/libc/grp/getgrgid.c
diff --git a/libc-0.0.4/grp/getgrnam.c b/libc/grp/getgrnam.c
index e6c27fc..e6c27fc 100644
--- a/libc-0.0.4/grp/getgrnam.c
+++ b/libc/grp/getgrnam.c
diff --git a/libc-0.0.4/grp/grent.c b/libc/grp/grent.c
index 19d618b..19d618b 100644
--- a/libc-0.0.4/grp/grent.c
+++ b/libc/grp/grent.c
diff --git a/libc-0.0.4/grp/initgroups.c b/libc/grp/initgroups.c
index df3ffa8..35e1d03 100644
--- a/libc-0.0.4/grp/initgroups.c
+++ b/libc/grp/initgroups.c
@@ -22,7 +22,7 @@
#include <string.h>
#include <fcntl.h>
#include <grp.h>
-#include "config-grp.h"
+#include "config.h"
int
initgroups(__const char * user, gid_t gid)
diff --git a/libc-0.0.4/grp/test_grp.c b/libc/grp/test_grp.c
index b5ecd36..b5ecd36 100644
--- a/libc-0.0.4/grp/test_grp.c
+++ b/libc/grp/test_grp.c
diff --git a/libc/gtermcap/COPYING b/libc/gtermcap/COPYING
new file mode 100644
index 0000000..a43ea21
--- /dev/null
+++ b/libc/gtermcap/COPYING
@@ -0,0 +1,339 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 675 Mass Ave, Cambridge, MA 02139, USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ Appendix: How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) 19yy <name of author>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) 19yy name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Library General
+Public License instead of this License.
diff --git a/libc/gtermcap/ChangeLog b/libc/gtermcap/ChangeLog
new file mode 100644
index 0000000..22d6ceb
--- /dev/null
+++ b/libc/gtermcap/ChangeLog
@@ -0,0 +1,52 @@
+Sat Apr 17 13:50:10 1993 H.J. Lu (hlu@nighthawk)
+
+ * modify termcap.c and tparam.c for Linux.
+
+Thu Apr 15 12:45:10 1993 David J. MacKenzie (djm@kropotkin.gnu.ai.mit.edu)
+
+ * Version 1.2.
+
+ * tparam.c [!emacs] (xmalloc, xrealloc, memory_out): New functions.
+ (tparam1): Use them.
+
+ * termcap.c, tparam.c: Use NULL or '\0' where appropriate
+ instead of 0. Rename some vars.
+ * termcap.c (tgetent): If EOF is reached on termcap file,
+ free allocated resources before returning.
+
+ * termcap.c (tgetent): Use /etc/termcap if TERMCAP is an entry
+ for a term type other than TERM.
+ From pjr@jet.UK (Paul J Rippin).
+
+Sat Apr 10 23:55:12 1993 Richard Stallman (rms@mole.gnu.ai.mit.edu)
+
+ * tparam.c (tparam1): Don't set the 0200 bit on a non-0 character code.
+ From junio@twinsun.COM (Junio Hamano).
+
+Tue Dec 8 22:02:15 1992 David J. MacKenzie (djm@kropotkin.gnu.ai.mit.edu)
+
+ * termcap.c, tparam.c: Use HAVE_STRING_H instead of USG.
+
+Thu Dec 3 13:47:56 1992 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu)
+
+ * termcap.c, tparam.c [HAVE_CONFIG_H]: Include config.h.
+
+Fri Oct 23 12:35:29 1992 David J. MacKenzie (djm@goldman.gnu.ai.mit.edu)
+
+ * termcap.h [__STDC__]: Add consts. From Franc,ois Pinard.
+
+Tue Oct 13 15:52:21 1992 David J. MacKenzie (djm@goldman.gnu.ai.mit.edu)
+
+ * Version 1.1.
+
+Tue Sep 29 21:04:39 1992 David J. MacKenzie (djm@geech.gnu.ai.mit.edu)
+
+ * termcap.[ch], tparam.c: Fix some lint.
+
+ * version.c: New file.
+
+Local Variables:
+mode: indented-text
+left-margin: 8
+version-control: never
+End:
diff --git a/libc/gtermcap/Makefile b/libc/gtermcap/Makefile
new file mode 100644
index 0000000..fe4e8ae
--- /dev/null
+++ b/libc/gtermcap/Makefile
@@ -0,0 +1,21 @@
+# Copyright (C) 1995,1996 Robert de Bath <rdebath@cix.compulink.co.uk>
+# This file is part of the Linux-8086 C library and is distributed
+# under the GNU Library General Public License.
+
+TOP=..
+include $(TOP)/Make.defs
+
+OBJ=termcap.o tparam.o
+
+all: $(OBJ)
+
+libc.a: $(OBJ)
+ ar r ../$(LIBC) $(OBJ)
+ @touch libc.a
+
+clean:
+ rm -f *.o libc.a
+
+$(SOBJ): $(SSRC)
+ $(CC) $(CFLAGS) -c -DL_$* -o $@ $(SSRC)
+
diff --git a/libc/gtermcap/Makefile.old b/libc/gtermcap/Makefile.old
new file mode 100644
index 0000000..453c47a
--- /dev/null
+++ b/libc/gtermcap/Makefile.old
@@ -0,0 +1,25 @@
+#
+# Makefile for termcap functions
+#
+
+override DEBUG=false
+override PROFILE=false
+#override CHECKER=false
+JUMP_LIB=libtermcap
+
+TOPDIR=..
+
+include $(TOPDIR)/Makeconfig
+include $(TOPDIR)/Makerules
+
+override STATIC_LIB=$(STATIC_DIR)/libtermcap.a
+override SHARED_LIB=$(SHARED_DIR)/libtermcap.a
+override CHECKER_LIB=$(CHECKER_DIR)/libtermcap.a
+
+DIRS:=
+SRCS = termcap.c tparam.c
+ASMS= $(SRCS:.c=.s)
+OBJS= $(SRCS:.c=.o)
+ALIASES=
+
+include $(TOPDIR)/Maketargets
diff --git a/libc/gtermcap/NEWS b/libc/gtermcap/NEWS
new file mode 100644
index 0000000..c696fdf
--- /dev/null
+++ b/libc/gtermcap/NEWS
@@ -0,0 +1,12 @@
+Major changes in release 1.2:
+
+For `%.', only set the high bit on NUL.
+Fix a file descriptor and memory leak.
+Add const in termcap.h prototypes.
+Configuration improvements.
+
+Major changes in release 1.1:
+
+Fix portability problems.
+Improve configuration and installation.
+Fix compiler warnings.
diff --git a/libc/gtermcap/README b/libc/gtermcap/README
new file mode 100644
index 0000000..9db9095
--- /dev/null
+++ b/libc/gtermcap/README
@@ -0,0 +1,14 @@
+This is the GNU termcap library -- a library of C functions that
+enable programs to send control strings to terminals in a way
+independent of the terminal type. Most of this package is also
+distributed with GNU Emacs, but it is available in this separate
+distribution to make it easier to install as -ltermcap.
+
+The GNU termcap library does not place an arbitrary limit on the size
+of termcap entries, unlike most other termcap libraries.
+
+See the file INSTALL for compilation and installation instructions.
+
+Please report any bugs in this library to bug-gnu-emacs@prep.ai.mit.edu.
+You can check which version of the library you have by using the RCS
+`ident' command on libtermcap.a.
diff --git a/libc/gtermcap/termcap.c b/libc/gtermcap/termcap.c
new file mode 100644
index 0000000..d79f51a
--- /dev/null
+++ b/libc/gtermcap/termcap.c
@@ -0,0 +1,827 @@
+/* Work-alike for termcap, plus extra features.
+ Copyright (C) 1985, 1986, 1993 Free Software Foundation, Inc.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; see the file COPYING. If not, write to
+the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
+
+/* Emacs config.h may rename various library functions such as malloc. */
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#else /* not HAVE_CONFIG_H */
+
+#ifdef __linux__
+#undef STDC_HEADERS
+#define STDC_HEADERS
+#define HAVE_UNISTD_H
+#define HAVE_SYS_IOCTL_H
+#else
+#if defined(HAVE_STRING_H) || defined(STDC_HEADERS)
+#define bcopy(s, d, n) memcpy ((d), (s), (n))
+#endif
+#endif
+
+#ifdef STDC_HEADERS
+#include <stdlib.h>
+#include <string.h>
+#else
+char *getenv ();
+char *malloc ();
+char *realloc ();
+#endif
+
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#ifdef _POSIX_VERSION
+#include <fcntl.h>
+#endif
+
+#ifdef HAVE_SYS_IOCTL_H
+#include <stdio.h>
+#include <sys/ioctl.h>
+#endif
+
+#endif /* not HAVE_CONFIG_H */
+
+#ifndef NULL
+#define NULL (char *) 0
+#endif
+
+/* BUFSIZE is the initial size allocated for the buffer
+ for reading the termcap file.
+ It is not a limit.
+ Make it large normally for speed.
+ Make it variable when debugging, so can exercise
+ increasing the space dynamically. */
+
+#ifndef BUFSIZE
+#ifdef DEBUG
+#define BUFSIZE bufsize
+
+int bufsize = 128;
+#else
+#define BUFSIZE 2048
+#endif
+#endif
+
+#ifdef TIOCGWINSZ
+#define ADJUST_WIN_EXTENT
+#endif
+
+#ifndef emacs
+static void
+memory_out ()
+{
+ write (2, "virtual memory exhausted\n", 25);
+ exit (1);
+}
+
+static char *
+xmalloc (size)
+ unsigned size;
+{
+ register char *tem = malloc (size);
+
+ if (!tem)
+ memory_out ();
+ return tem;
+}
+
+static char *
+xrealloc (ptr, size)
+ char *ptr;
+ unsigned size;
+{
+ register char *tem = realloc (ptr, size);
+
+ if (!tem)
+ memory_out ();
+ return tem;
+}
+#endif /* not emacs */
+
+/* Looking up capabilities in the entry already found. */
+
+/* The pointer to the data made by tgetent is left here
+ for tgetnum, tgetflag and tgetstr to find. */
+static char *term_entry;
+
+static char *tgetst1 ();
+
+/* Search entry BP for capability CAP.
+ Return a pointer to the capability (in BP) if found,
+ 0 if not found. */
+
+static char *
+find_capability (bp, cap)
+ register char *bp, *cap;
+{
+ for (; *bp; bp++)
+ if (bp[0] == ':'
+ && bp[1] == cap[0]
+ && bp[2] == cap[1])
+ return &bp[4];
+ return NULL;
+}
+
+int
+tgetnum (cap)
+ char *cap;
+{
+ register char *ptr = find_capability (term_entry, cap);
+ if (!ptr || ptr[-1] != '#')
+ return -1;
+ return atoi (ptr);
+}
+
+int
+tgetflag (cap)
+ char *cap;
+{
+ register char *ptr = find_capability (term_entry, cap);
+ return ptr && ptr[-1] == ':';
+}
+
+/* Look up a string-valued capability CAP.
+ If AREA is non-null, it points to a pointer to a block in which
+ to store the string. That pointer is advanced over the space used.
+ If AREA is null, space is allocated with `malloc'. */
+
+char *
+tgetstr (cap, area)
+ char *cap;
+ char **area;
+{
+ register char *ptr = find_capability (term_entry, cap);
+ if (!ptr || (ptr[-1] != '=' && ptr[-1] != '~'))
+ return NULL;
+ return tgetst1 (ptr, area);
+}
+
+/* Table, indexed by a character in range 0100 to 0140 with 0100 subtracted,
+ gives meaning of character following \, or a space if no special meaning.
+ Eight characters per line within the string. */
+
+static char esctab[]
+ = " \007\010 \033\014 \
+ \012 \
+ \015 \011 \013 \
+ ";
+
+/* PTR points to a string value inside a termcap entry.
+ Copy that value, processing \ and ^ abbreviations,
+ into the block that *AREA points to,
+ or to newly allocated storage if AREA is NULL.
+ Return the address to which we copied the value,
+ or NULL if PTR is NULL. */
+
+static char *
+tgetst1 (ptr, area)
+ char *ptr;
+ char **area;
+{
+ register char *p, *r;
+ register int c;
+ register int size;
+ char *ret;
+ register int c1;
+
+ if (!ptr)
+ return NULL;
+
+ /* `ret' gets address of where to store the string. */
+ if (!area)
+ {
+ /* Compute size of block needed (may overestimate). */
+ p = ptr;
+ while ((c = *p++) && c != ':' && c != '\n')
+ ;
+ ret = (char *) xmalloc (p - ptr + 1);
+ }
+ else
+ ret = *area;
+
+ /* Copy the string value, stopping at null or colon.
+ Also process ^ and \ abbreviations. */
+ p = ptr;
+ r = ret;
+ while ((c = *p++) && c != ':' && c != '\n')
+ {
+ if (c == '^')
+ c = *p++ & 037;
+ else if (c == '\\')
+ {
+ c = *p++;
+ if (c >= '0' && c <= '7')
+ {
+ c -= '0';
+ size = 0;
+
+ while (++size < 3 && (c1 = *p) >= '0' && c1 <= '7')
+ {
+ c *= 8;
+ c += c1 - '0';
+ p++;
+ }
+ }
+ else if (c >= 0100 && c < 0200)
+ {
+ c1 = esctab[(c & ~040) - 0100];
+ if (c1 != ' ')
+ c = c1;
+ }
+ }
+ *r++ = c;
+ }
+ *r = '\0';
+ /* Update *AREA. */
+ if (area)
+ *area = r + 1;
+ return ret;
+}
+
+/* Outputting a string with padding. */
+
+#ifdef __linux__
+speed_t ospeed;
+#else
+short ospeed;
+#endif
+/* If OSPEED is 0, we use this as the actual baud rate. */
+int tputs_baud_rate;
+char PC;
+
+/* Actual baud rate if positive;
+ - baud rate / 100 if negative. */
+
+static short speeds[] =
+ {
+#ifdef VMS
+ 0, 50, 75, 110, 134, 150, -3, -6, -12, -18,
+ -20, -24, -36, -48, -72, -96, -192
+#else /* not VMS */
+ 0, 50, 75, 110, 135, 150, -2, -3, -6, -12,
+ -18, -24, -48, -96, -192, -384
+#endif /* not VMS */
+ };
+
+void
+tputs (str, nlines, outfun)
+ register char *str;
+ int nlines;
+ register int (*outfun) ();
+{
+ register int padcount = 0;
+ register int speed;
+
+#ifdef emacs
+ extern baud_rate;
+ speed = baud_rate;
+#else
+ if (ospeed == 0)
+ speed = tputs_baud_rate;
+ else
+ speed = speeds[ospeed];
+#endif
+
+ if (!str)
+ return;
+
+ while (*str >= '0' && *str <= '9')
+ {
+ padcount += *str++ - '0';
+ padcount *= 10;
+ }
+ if (*str == '.')
+ {
+ str++;
+ padcount += *str++ - '0';
+ }
+ if (*str == '*')
+ {
+ str++;
+ padcount *= nlines;
+ }
+ while (*str)
+ (*outfun) (*str++);
+
+ /* padcount is now in units of tenths of msec. */
+ padcount *= speeds[ospeed];
+ padcount += 500;
+ padcount /= 1000;
+ if (speeds[ospeed] < 0)
+ padcount = -padcount;
+ else
+ {
+ padcount += 50;
+ padcount /= 100;
+ }
+
+ while (padcount-- > 0)
+ (*outfun) (PC);
+}
+
+/* Finding the termcap entry in the termcap data base. */
+
+struct buffer
+ {
+ char *beg;
+ int size;
+ char *ptr;
+ int ateof;
+ int full;
+ };
+
+/* Forward declarations of static functions. */
+
+static int scan_file ();
+static char *gobble_line ();
+static int compare_contin ();
+static int name_match ();
+
+#ifdef ADJUST_WIN_EXTENT
+#ifdef TIOCGWINSZ
+static int
+get_win_extent(li, co)
+int *li, *co;
+{
+ struct winsize ws;
+
+ /* Some TIOCGWINSZ may be broken. Make sure ws.ws_row and
+ * ws.ws_col are not zero.
+ */
+ if (ioctl(0, TIOCGWINSZ, &ws) != 0 || !ws.ws_row || !ws.ws_col)
+ return -1;
+ *li = ws.ws_row;
+ *co = ws.ws_col;
+ return 0;
+}
+#endif /* TIOCGWINSZ */
+
+static int
+adjust_win_extent(bpp, howalloc, li, co)
+char **bpp;
+int howalloc; /* 0 must do in place, 1 must use malloc, 2 must use realloc */
+int li, co;
+{
+ int licolen, o_len, t, colon;
+ char *licobuf, *s;
+
+ if (li < 0 || co < 0)
+ return 0;
+ for (s = *bpp, colon = -1; *s; ++s)
+ if (*s == ':' && colon < 0)
+ colon = s - *bpp;
+ o_len = s - *bpp;
+ licolen = 11;
+ for (t = li; (t /= 10) > 0; ++licolen);
+ for (t = co; (t /= 10) > 0; ++licolen);
+
+ licobuf = xmalloc(licolen + 1);
+ sprintf(licobuf, ":li#%d:co#%d:", li, co);
+
+ if (howalloc == 0)
+ {
+ bcopy(*bpp + colon, *bpp + colon + licolen, o_len - colon + 1);
+ bcopy(licobuf, *bpp + colon, licolen);
+ }
+ else if (howalloc == 1)
+ {
+ char *newbp;
+
+ newbp = xmalloc(o_len + licolen + 1);
+ bcopy(*bpp, newbp, colon);
+ bcopy(licobuf, newbp + colon, licolen);
+ strcpy(newbp + colon + licolen, *bpp + colon);
+ *bpp = newbp;
+ }
+ else /* (howalloc == 2) */
+ {
+ char *newbp;
+
+ newbp = xrealloc(*bpp, o_len + licolen + 1);
+ bcopy(newbp + colon, newbp + colon + licolen, o_len - colon + 1);
+ bcopy(licobuf, newbp + colon, licolen);
+ *bpp = newbp;
+ }
+
+ free(licobuf);
+ return 1;
+}
+#endif /* ADJUST_WIN_EXTENT */
+
+#ifdef VMS
+
+#include <rmsdef.h>
+#include <fab.h>
+#include <nam.h>
+
+static int
+valid_filename_p (fn)
+ char *fn;
+{
+ struct FAB fab = cc$rms_fab;
+ struct NAM nam = cc$rms_nam;
+ char esa[NAM$C_MAXRSS];
+
+ fab.fab$l_fna = fn;
+ fab.fab$b_fns = strlen(fn);
+ fab.fab$l_nam = &nam;
+ fab.fab$l_fop = FAB$M_NAM;
+
+ nam.nam$l_esa = esa;
+ nam.nam$b_ess = sizeof esa;
+
+ return SYS$PARSE(&fab, 0, 0) == RMS$_NORMAL;
+}
+
+#else /* !VMS */
+
+#define valid_filename_p(fn) (*(fn) == '/')
+
+#endif /* !VMS */
+
+/* Find the termcap entry data for terminal type NAME
+ and store it in the block that BP points to.
+ Record its address for future use.
+
+ If BP is null, space is dynamically allocated.
+
+ Return -1 if there is some difficulty accessing the data base
+ of terminal types,
+ 0 if the data base is accessible but the type NAME is not defined
+ in it, and some other value otherwise. */
+
+int
+tgetent (bp, name)
+ char *bp, *name;
+{
+ register char *termcap_name;
+ register int fd;
+ struct buffer buf;
+ register char *bp1;
+ char *bp2;
+ char *term;
+ int malloc_size = 0;
+ register int c;
+ char *tcenv; /* TERMCAP value, if it contains :tc=. */
+ char *indirect = NULL; /* Terminal type in :tc= in TERMCAP value. */
+ int filep;
+#ifdef ADJUST_WIN_EXTENT
+ int li, co; /* #lines and columns on this tty */
+
+ if (get_win_extent(&li, &co) != 0)
+ li = co = -1;
+#endif /* ADJUST_WIN_EXTENT */
+
+ termcap_name = getenv ("TERMCAP");
+ if (termcap_name && *termcap_name == '\0')
+ termcap_name = NULL;
+
+ filep = termcap_name && valid_filename_p (termcap_name);
+
+ /* If termcap_name is non-null and starts with / (in the un*x case, that is),
+ it is a file name to use instead of /etc/termcap.
+ If it is non-null and does not start with /,
+ it is the entry itself, but only if
+ the name the caller requested matches the TERM variable. */
+
+ if (termcap_name && !filep && !strcmp (name, getenv ("TERM")))
+ {
+ indirect = tgetst1 (find_capability (termcap_name, "tc"), (char **) 0);
+ if (!indirect)
+ {
+ if (!bp)
+ {
+ bp = termcap_name;
+#ifdef ADJUST_WIN_EXTENT
+ if (adjust_win_extent(&bp, 1, li, co))
+ malloc_size = 1; /* force return of bp */
+#endif /* ADJUST_WIN_EXTENT */
+ }
+ else
+ {
+ strcpy (bp, termcap_name);
+#ifdef ADJUST_WIN_EXTENT
+ adjust_win_extent(&bp, 0, li, co);
+#endif /* ADJUST_WIN_EXTENT */
+ }
+ goto ret;
+ }
+ else
+ { /* It has tc=. Need to read /etc/termcap. */
+ tcenv = termcap_name;
+ termcap_name = NULL;
+ }
+ }
+
+ if (!termcap_name || !filep)
+#ifdef VMS
+ termcap_name = "emacs_library:[etc]termcap.dat";
+#else
+ termcap_name = "/etc/termcap";
+#endif
+
+ /* Here we know we must search a file and termcap_name has its name. */
+
+ fd = open (termcap_name, 0, 0);
+ if (fd < 0)
+ return -1;
+
+ buf.size = BUFSIZE;
+ /* Add 1 to size to ensure room for terminating null. */
+ buf.beg = (char *) xmalloc (buf.size + 1);
+ term = indirect ? indirect : name;
+
+ if (!bp)
+ {
+ malloc_size = indirect ? strlen (tcenv) + 1 : buf.size;
+ bp = (char *) xmalloc (malloc_size);
+ }
+ bp1 = bp;
+
+ if (indirect)
+ /* Copy the data from the environment variable. */
+ {
+ strcpy (bp, tcenv);
+ bp1 += strlen (tcenv);
+ }
+
+ while (term)
+ {
+ /* Scan the file, reading it via buf, till find start of main entry. */
+ if (scan_file (term, fd, &buf) == 0)
+ {
+ close (fd);
+ free (buf.beg);
+ if (malloc_size)
+ free (bp);
+ return 0;
+ }
+
+ /* Free old `term' if appropriate. */
+ if (term != name)
+ free (term);
+
+ /* If BP is malloc'd by us, make sure it is big enough. */
+ if (malloc_size)
+ {
+ malloc_size = bp1 - bp + buf.size;
+ termcap_name = (char *) xrealloc (bp, malloc_size);
+ bp1 += termcap_name - bp;
+ bp = termcap_name;
+ }
+
+ bp2 = bp1;
+
+ /* Copy the line of the entry from buf into bp. */
+ termcap_name = buf.ptr;
+ while ((*bp1++ = c = *termcap_name++) && c != '\n')
+ /* Drop out any \ newline sequence. */
+ if (c == '\\' && *termcap_name == '\n')
+ {
+ bp1--;
+ termcap_name++;
+ }
+ *bp1 = '\0';
+
+ /* Does this entry refer to another terminal type's entry?
+ If something is found, copy it into heap and null-terminate it. */
+ term = tgetst1 (find_capability (bp2, "tc"), (char **) 0);
+ }
+
+ close (fd);
+ free (buf.beg);
+
+ if (malloc_size)
+ bp = (char *) xrealloc (bp, bp1 - bp + 1);
+#ifdef ADJUST_WIN_EXTENT
+ adjust_win_extent(&bp, malloc_size ? 2 : 0, li, co);
+#endif /* ADJUST_WIN_EXTENT */
+
+ ret:
+ term_entry = bp;
+ if (malloc_size)
+ return (int) bp;
+ return 1;
+}
+
+/* Given file open on FD and buffer BUFP,
+ scan the file from the beginning until a line is found
+ that starts the entry for terminal type STR.
+ Return 1 if successful, with that line in BUFP,
+ or 0 if no entry is found in the file. */
+
+static int
+scan_file (str, fd, bufp)
+ char *str;
+ int fd;
+ register struct buffer *bufp;
+{
+ register char *end;
+
+ bufp->ptr = bufp->beg;
+ bufp->full = 0;
+ bufp->ateof = 0;
+ *bufp->ptr = '\0';
+
+ lseek (fd, 0L, 0);
+
+ while (!bufp->ateof)
+ {
+ /* Read a line into the buffer. */
+ end = NULL;
+ do
+ {
+ /* if it is continued, append another line to it,
+ until a non-continued line ends. */
+ end = gobble_line (fd, bufp, end);
+ }
+ while (!bufp->ateof && end[-2] == '\\');
+
+ if (*bufp->ptr != '#'
+ && name_match (bufp->ptr, str))
+ return 1;
+
+ /* Discard the line just processed. */
+ bufp->ptr = end;
+ }
+ return 0;
+}
+
+/* Return nonzero if NAME is one of the names specified
+ by termcap entry LINE. */
+
+static int
+name_match (line, name)
+ char *line, *name;
+{
+ register char *tem;
+
+ if (!compare_contin (line, name))
+ return 1;
+ /* This line starts an entry. Is it the right one? */
+ for (tem = line; *tem && *tem != '\n' && *tem != ':'; tem++)
+ if (*tem == '|' && !compare_contin (tem + 1, name))
+ return 1;
+
+ return 0;
+}
+
+static int
+compare_contin (str1, str2)
+ register char *str1, *str2;
+{
+ register int c1, c2;
+ while (1)
+ {
+ c1 = *str1++;
+ c2 = *str2++;
+ while (c1 == '\\' && *str1 == '\n')
+ {
+ str1++;
+ while ((c1 = *str1++) == ' ' || c1 == '\t');
+ }
+ if (c2 == '\0')
+ {
+ /* End of type being looked up. */
+ if (c1 == '|' || c1 == ':')
+ /* If end of name in data base, we win. */
+ return 0;
+ else
+ return 1;
+ }
+ else if (c1 != c2)
+ return 1;
+ }
+}
+
+/* Make sure that the buffer <- BUFP contains a full line
+ of the file open on FD, starting at the place BUFP->ptr
+ points to. Can read more of the file, discard stuff before
+ BUFP->ptr, or make the buffer bigger.
+
+ Return the pointer to after the newline ending the line,
+ or to the end of the file, if there is no newline to end it.
+
+ Can also merge on continuation lines. If APPEND_END is
+ non-null, it points past the newline of a line that is
+ continued; we add another line onto it and regard the whole
+ thing as one line. The caller decides when a line is continued. */
+
+static char *
+gobble_line (fd, bufp, append_end)
+ int fd;
+ register struct buffer *bufp;
+ char *append_end;
+{
+ register char *end;
+ register int nread;
+ register char *buf = bufp->beg;
+ register char *tem;
+
+ if (!append_end)
+ append_end = bufp->ptr;
+
+ while (1)
+ {
+ end = append_end;
+ while (*end && *end != '\n') end++;
+ if (*end)
+ break;
+ if (bufp->ateof)
+ return buf + bufp->full;
+ if (bufp->ptr == buf)
+ {
+ if (bufp->full == bufp->size)
+ {
+ bufp->size *= 2;
+ /* Add 1 to size to ensure room for terminating null. */
+ tem = (char *) xrealloc (buf, bufp->size + 1);
+ bufp->ptr = (bufp->ptr - buf) + tem;
+ append_end = (append_end - buf) + tem;
+ bufp->beg = buf = tem;
+ }
+ }
+ else
+ {
+ append_end -= bufp->ptr - buf;
+ bcopy (bufp->ptr, buf, bufp->full -= bufp->ptr - buf);
+ bufp->ptr = buf;
+ }
+ if (!(nread = read (fd, buf + bufp->full, bufp->size - bufp->full)))
+ bufp->ateof = 1;
+ bufp->full += nread;
+ buf[bufp->full] = '\0';
+ }
+ return end + 1;
+}
+
+#ifdef TEST
+
+#ifdef NULL
+#undef NULL
+#endif
+
+#include <stdio.h>
+
+main (argc, argv)
+ int argc;
+ char **argv;
+{
+ char *term;
+ char *buf;
+
+ term = argv[1];
+ printf ("TERM: %s\n", term);
+
+ buf = (char *) tgetent (0, term);
+ if ((int) buf <= 0)
+ {
+ printf ("No entry.\n");
+ return 0;
+ }
+
+ printf ("Entry: %s\n", buf);
+
+ tprint ("cm");
+ tprint ("AL");
+
+ printf ("co: %d\n", tgetnum ("co"));
+ printf ("am: %d\n", tgetflag ("am"));
+}
+
+tprint (cap)
+ char *cap;
+{
+ char *x = tgetstr (cap, 0);
+ register char *y;
+
+ printf ("%s: ", cap);
+ if (x)
+ {
+ for (y = x; *y; y++)
+ if (*y <= ' ' || *y == 0177)
+ printf ("\\%0o", *y);
+ else
+ putchar (*y);
+ free (x);
+ }
+ else
+ printf ("none");
+ putchar ('\n');
+}
+
+#endif /* TEST */
+
diff --git a/libc/gtermcap/tparam.c b/libc/gtermcap/tparam.c
new file mode 100644
index 0000000..565946c
--- /dev/null
+++ b/libc/gtermcap/tparam.c
@@ -0,0 +1,330 @@
+/* Merge parameters into a termcap entry string.
+ Copyright (C) 1985, 1987, 1993 Free Software Foundation, Inc.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; see the file COPYING. If not, write to
+the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
+
+/* Emacs config.h may rename various library functions such as malloc. */
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#else /* not HAVE_CONFIG_H */
+
+#ifdef __linux__
+#undef STDC_HEADERS
+#define STDC_HEADERS
+#define HAVE_UNISTD_H
+#if defined(HAVE_STRING_H) || defined(STDC_HEADERS)
+#define bcopy(s, d, n) memcpy ((d), (s), (n))
+#endif
+#endif
+
+#ifdef STDC_HEADERS
+#include <stdlib.h>
+#include <string.h>
+#else
+char *malloc ();
+char *realloc ();
+#endif
+
+#endif /* not HAVE_CONFIG_H */
+
+#ifndef NULL
+#define NULL (char *) 0
+#endif
+
+#ifndef emacs
+static void
+memory_out ()
+{
+ write (2, "virtual memory exhausted\n", 25);
+ exit (1);
+}
+
+static char *
+xmalloc (size)
+ unsigned size;
+{
+ register char *tem = malloc (size);
+
+ if (!tem)
+ memory_out ();
+ return tem;
+}
+
+static char *
+xrealloc (ptr, size)
+ char *ptr;
+ unsigned size;
+{
+ register char *tem = realloc (ptr, size);
+
+ if (!tem)
+ memory_out ();
+ return tem;
+}
+#endif /* not emacs */
+
+/* Assuming STRING is the value of a termcap string entry
+ containing `%' constructs to expand parameters,
+ merge in parameter values and store result in block OUTSTRING points to.
+ LEN is the length of OUTSTRING. If more space is needed,
+ a block is allocated with `malloc'.
+
+ The value returned is the address of the resulting string.
+ This may be OUTSTRING or may be the address of a block got with `malloc'.
+ In the latter case, the caller must free the block.
+
+ The fourth and following args to tparam serve as the parameter values. */
+
+static char *tparam1 ();
+
+/* VARARGS 2 */
+char *
+tparam (string, outstring, len, arg0, arg1, arg2, arg3)
+ char *string;
+ char *outstring;
+ int len;
+ int arg0, arg1, arg2, arg3;
+{
+#ifdef NO_ARG_ARRAY
+ int arg[4];
+ arg[0] = arg0;
+ arg[1] = arg1;
+ arg[2] = arg2;
+ arg[3] = arg3;
+ return tparam1 (string, outstring, len, NULL, NULL, arg);
+#else
+ return tparam1 (string, outstring, len, NULL, NULL, &arg0);
+#endif
+}
+
+char *BC;
+char *UP;
+
+static char tgoto_buf[50];
+
+char *
+tgoto (cm, hpos, vpos)
+ char *cm;
+ int hpos, vpos;
+{
+ int args[2];
+ if (!cm)
+ return NULL;
+ args[0] = vpos;
+ args[1] = hpos;
+ return tparam1 (cm, tgoto_buf, 50, UP, BC, args);
+}
+
+static char *
+tparam1 (string, outstring, len, up, left, argp)
+ char *string;
+ char *outstring;
+ int len;
+ char *up, *left;
+ register int *argp;
+{
+ register int c;
+ register char *p = string;
+ register char *op = outstring;
+ char *outend;
+ int outlen = 0;
+
+ register int tem;
+ int *old_argp = argp;
+ int doleft = 0;
+ int doup = 0;
+
+ outend = outstring + len;
+
+ while (1)
+ {
+ /* If the buffer might be too short, make it bigger. */
+ if (op + 5 >= outend)
+ {
+ register char *new;
+ if (outlen == 0)
+ {
+ outlen = len + 40;
+ new = (char *) xmalloc (outlen);
+ outend += 40;
+ bcopy (outstring, new, op - outstring);
+ }
+ else
+ {
+ outend += outlen;
+ outlen *= 2;
+ new = (char *) xrealloc (outstring, outlen);
+ }
+ op += new - outstring;
+ outend += new - outstring;
+ outstring = new;
+ }
+ c = *p++;
+ if (!c)
+ break;
+ if (c == '%')
+ {
+ c = *p++;
+ tem = *argp;
+ switch (c)
+ {
+ case 'd': /* %d means output in decimal. */
+ if (tem < 10)
+ goto onedigit;
+ if (tem < 100)
+ goto twodigit;
+ case '3': /* %3 means output in decimal, 3 digits. */
+ if (tem > 999)
+ {
+ *op++ = tem / 1000 + '0';
+ tem %= 1000;
+ }
+ *op++ = tem / 100 + '0';
+ case '2': /* %2 means output in decimal, 2 digits. */
+ twodigit:
+ tem %= 100;
+ *op++ = tem / 10 + '0';
+ onedigit:
+ *op++ = tem % 10 + '0';
+ argp++;
+ break;
+
+ case 'C':
+ /* For c-100: print quotient of value by 96, if nonzero,
+ then do like %+. */
+ if (tem >= 96)
+ {
+ *op++ = tem / 96;
+ tem %= 96;
+ }
+ case '+': /* %+x means add character code of char x. */
+ tem += *p++;
+ case '.': /* %. means output as character. */
+ if (left)
+ {
+ /* If want to forbid output of 0 and \n and \t,
+ and this is one of them, increment it. */
+ while (tem == 0 || tem == '\n' || tem == '\t')
+ {
+ tem++;
+ if (argp == old_argp)
+ doup++, outend -= strlen (up);
+ else
+ doleft++, outend -= strlen (left);
+ }
+ }
+ *op++ = tem ? tem : 0200;
+ case 'f': /* %f means discard next arg. */
+ argp++;
+ break;
+
+ case 'b': /* %b means back up one arg (and re-use it). */
+ argp--;
+ break;
+
+ case 'r': /* %r means interchange following two args. */
+ argp[0] = argp[1];
+ argp[1] = tem;
+ old_argp++;
+ break;
+
+ case '>': /* %>xy means if arg is > char code of x, */
+ if (argp[0] > *p++) /* then add char code of y to the arg, */
+ argp[0] += *p; /* and in any case don't output. */
+ p++; /* Leave the arg to be output later. */
+ break;
+
+ case 'a': /* %a means arithmetic. */
+ /* Next character says what operation.
+ Add or subtract either a constant or some other arg. */
+ /* First following character is + to add or - to subtract
+ or = to assign. */
+ /* Next following char is 'p' and an arg spec
+ (0100 plus position of that arg relative to this one)
+ or 'c' and a constant stored in a character. */
+ tem = p[2] & 0177;
+ if (p[1] == 'p')
+ tem = argp[tem - 0100];
+ if (p[0] == '-')
+ argp[0] -= tem;
+ else if (p[0] == '+')
+ argp[0] += tem;
+ else if (p[0] == '*')
+ argp[0] *= tem;
+ else if (p[0] == '/')
+ argp[0] /= tem;
+ else
+ argp[0] = tem;
+
+ p += 3;
+ break;
+
+ case 'i': /* %i means add one to arg, */
+ argp[0] ++; /* and leave it to be output later. */
+ argp[1] ++; /* Increment the following arg, too! */
+ break;
+
+ case '%': /* %% means output %; no arg. */
+ goto ordinary;
+
+ case 'n': /* %n means xor each of next two args with 140. */
+ argp[0] ^= 0140;
+ argp[1] ^= 0140;
+ break;
+
+ case 'm': /* %m means xor each of next two args with 177. */
+ argp[0] ^= 0177;
+ argp[1] ^= 0177;
+ break;
+
+ case 'B': /* %B means express arg as BCD char code. */
+ argp[0] += 6 * (tem / 10);
+ break;
+
+ case 'D': /* %D means weird Delta Data transformation. */
+ argp[0] -= 2 * (tem % 16);
+ break;
+ }
+ }
+ else
+ /* Ordinary character in the argument string. */
+ ordinary:
+ *op++ = c;
+ }
+ *op = 0;
+ while (doup-- > 0)
+ strcat (op, up);
+ while (doleft-- > 0)
+ strcat (op, left);
+ return outstring;
+}
+
+#ifdef DEBUG
+
+main (argc, argv)
+ int argc;
+ char **argv;
+{
+ char buf[50];
+ int args[3];
+ args[0] = atoi (argv[2]);
+ args[1] = atoi (argv[3]);
+ args[2] = atoi (argv[4]);
+ tparam1 (argv[1], buf, "LEFT", "UP", args);
+ printf ("%s\n", buf);
+ return 0;
+}
+
+#endif /* DEBUG */
diff --git a/libc/gtermcap/version.c b/libc/gtermcap/version.c
new file mode 100644
index 0000000..d4c44bc
--- /dev/null
+++ b/libc/gtermcap/version.c
@@ -0,0 +1,2 @@
+/* Make the library identifiable with the RCS ident command. */
+static char *version_string = "\n$Version: GNU termcap 1.2.2 $\n";
diff --git a/libc-0.0.4/include/a.out.h b/libc/include/a.out.h
index f6a7b94..f6a7b94 100644
--- a/libc-0.0.4/include/a.out.h
+++ b/libc/include/a.out.h
diff --git a/libc-0.0.4/include/ar.h b/libc/include/ar.h
index c608371..c608371 100644
--- a/libc-0.0.4/include/ar.h
+++ b/libc/include/ar.h
diff --git a/libc-0.0.4/include/assert.h b/libc/include/assert.h
index c58c57f..c58c57f 100644
--- a/libc-0.0.4/include/assert.h
+++ b/libc/include/assert.h
diff --git a/libc-0.0.4/include/ctype.h b/libc/include/ctype.h
index 038659f..038659f 100644
--- a/libc-0.0.4/include/ctype.h
+++ b/libc/include/ctype.h
diff --git a/libc-0.0.4/include/dirent.h b/libc/include/dirent.h
index 0a931b9..c2e8f37 100644
--- a/libc-0.0.4/include/dirent.h
+++ b/libc/include/dirent.h
@@ -17,6 +17,13 @@ typedef struct {
struct dirent *dd_buf; /* -> directory buffer */
} DIR; /* stream data from opendir() */
+typedef int (*__dir_select_fn_t) __P ((__const struct dirent *));
+
+typedef int (*__dir_compar_fn_t) __P ((
+ __const struct dirent * __const *,
+ __const struct dirent * __const *
+ ));
+
struct dirent {
long d_ino;
off_t d_off;
@@ -29,7 +36,7 @@ extern int closedir __P ((DIR * __dirp));
extern struct dirent *readdir __P ((DIR * __dirp));
extern void rewinddir __P ((DIR * __dirp));
-extern void seekdir __P ((DIR * __dirp, __off_t __pos));
+extern void seekdir __P ((DIR * __dirp, off_t __pos));
extern off_t telldir __P ((DIR * __dirp));
/* Scan the directory DIR, calling SELECT on each directory entry.
diff --git a/libc-0.0.4/include/dos.h b/libc/include/dos.h
index 28575b4..28575b4 100644
--- a/libc-0.0.4/include/dos.h
+++ b/libc/include/dos.h
diff --git a/libc-0.0.4/include/errno.h b/libc/include/errno.h
index c8d2002..c8d2002 100644
--- a/libc-0.0.4/include/errno.h
+++ b/libc/include/errno.h
diff --git a/libc-0.0.4/include/fcntl.h b/libc/include/fcntl.h
index ddd9afc..ddd9afc 100644
--- a/libc-0.0.4/include/fcntl.h
+++ b/libc/include/fcntl.h
diff --git a/libc-0.0.4/include/features.h b/libc/include/features.h
index 11eb610..11eb610 100644
--- a/libc-0.0.4/include/features.h
+++ b/libc/include/features.h
diff --git a/libc-0.0.4/include/getopt.h b/libc/include/getopt.h
index 0d71ff6..0d71ff6 100644
--- a/libc-0.0.4/include/getopt.h
+++ b/libc/include/getopt.h
diff --git a/libc-0.0.4/include/grp.h b/libc/include/grp.h
index 96b2b4b..96b2b4b 100644
--- a/libc-0.0.4/include/grp.h
+++ b/libc/include/grp.h
diff --git a/libc-0.0.4/include/limits.h b/libc/include/limits.h
index 579287e..579287e 100644
--- a/libc-0.0.4/include/limits.h
+++ b/libc/include/limits.h
diff --git a/libc-0.0.4/include/malloc.h b/libc/include/malloc.h
index c00fa21..e8fdb0a 100644
--- a/libc-0.0.4/include/malloc.h
+++ b/libc/include/malloc.h
@@ -2,6 +2,7 @@
#ifndef __MALLOC_H
#define __MALLOC_H
#include <features.h>
+#include <sys/types.h>
/*
* Mini malloc allows you to use a less efficient but smaller malloc the
@@ -11,12 +12,12 @@
*
*/
-void free __P((void *));
-void *malloc __P((unsigned int));
-void *realloc __P((void *, unsigned int));
-void *alloca __P((unsigned int));
+extern void free __P((void *));
+extern void *malloc __P((size_t));
+extern void *realloc __P((void *, size_t));
+extern void *alloca __P((size_t));
-extern void *(*__alloca_alloc) __P((unsigned int));
+extern void *(*__alloca_alloc) __P((size_t));
#ifdef __LIBC__
#define __MINI_MALLOC__
diff --git a/libc-0.0.4/include/memory.h b/libc/include/memory.h
index 3b2f590..3b2f590 100644
--- a/libc-0.0.4/include/memory.h
+++ b/libc/include/memory.h
diff --git a/libc-0.0.4/include/paths.h b/libc/include/paths.h
index 58bade7..58bade7 100644
--- a/libc-0.0.4/include/paths.h
+++ b/libc/include/paths.h
diff --git a/libc-0.0.4/include/pwd.h b/libc/include/pwd.h
index 1b48c6a..1b48c6a 100644
--- a/libc-0.0.4/include/pwd.h
+++ b/libc/include/pwd.h
diff --git a/libc-0.0.4/include/regexp.h b/libc/include/regexp.h
index 73d6bf4..73d6bf4 100644
--- a/libc-0.0.4/include/regexp.h
+++ b/libc/include/regexp.h
diff --git a/libc-0.0.4/include/regmagic.h b/libc/include/regmagic.h
index 5acf447..5acf447 100644
--- a/libc-0.0.4/include/regmagic.h
+++ b/libc/include/regmagic.h
diff --git a/libc-0.0.4/include/search.h b/libc/include/search.h
index b9c8a17..b9c8a17 100644
--- a/libc-0.0.4/include/search.h
+++ b/libc/include/search.h
diff --git a/libc-0.0.4/include/setjmp.h b/libc/include/setjmp.h
index c2bfadb..c2bfadb 100644
--- a/libc-0.0.4/include/setjmp.h
+++ b/libc/include/setjmp.h
diff --git a/libc-0.0.4/include/sgtty.h b/libc/include/sgtty.h
index 9e26956..9e26956 100644
--- a/libc-0.0.4/include/sgtty.h
+++ b/libc/include/sgtty.h
diff --git a/libc-0.0.4/include/signal.h b/libc/include/signal.h
index 1d54fc3..1d54fc3 100644
--- a/libc-0.0.4/include/signal.h
+++ b/libc/include/signal.h
diff --git a/libc-0.0.4/include/stdarg.h b/libc/include/stdarg.h
index 978529b..978529b 100644
--- a/libc-0.0.4/include/stdarg.h
+++ b/libc/include/stdarg.h
diff --git a/libc-0.0.4/include/stddef.h b/libc/include/stddef.h
index 112c18f..f21f683 100644
--- a/libc-0.0.4/include/stddef.h
+++ b/libc/include/stddef.h
@@ -22,5 +22,5 @@ typedef unsigned int size_t;
#define NULL 0
#endif
-#endif
-#endif
+#endif /* __STDDEF_H */
+#endif /* __AS386_16__ */
diff --git a/libc-0.0.4/include/stdio.h b/libc/include/stdio.h
index ba70b1d..ba70b1d 100644
--- a/libc-0.0.4/include/stdio.h
+++ b/libc/include/stdio.h
diff --git a/libc-0.0.4/include/stdlib.h b/libc/include/stdlib.h
index 9f235d8..f67984a 100644
--- a/libc-0.0.4/include/stdlib.h
+++ b/libc/include/stdlib.h
@@ -14,10 +14,10 @@
#define EXIT_FAILURE 1
#define EXIT_SUCCESS 0
-extern void * malloc __P ((size_t size));
-extern void * calloc __P ((size_t nmemb, size_t size));
-extern void free __P ((void * ptr));
-extern void * realloc __P ((void * ptr, size_t size));
+extern void * malloc __P ((size_t));
+extern void * calloc __P ((size_t, size_t));
+extern void free __P ((void *));
+extern void * realloc __P ((void *, size_t));
extern int rand __P ((void));
extern void srand __P ((unsigned int seed));
diff --git a/libc-0.0.4/string/string.h b/libc/include/string.h
index 8be8eff..2233bf9 100644
--- a/libc-0.0.4/string/string.h
+++ b/libc/include/string.h
@@ -2,6 +2,7 @@
#ifndef __STRING_H
#define __STRING_H
#include <features.h>
+#include <sys/types.h>
#include <stddef.h>
/* Basic string functions */
diff --git a/libc-0.0.4/include/strings.h b/libc/include/strings.h
index 3b2f590..3b2f590 100644
--- a/libc-0.0.4/include/strings.h
+++ b/libc/include/strings.h
diff --git a/libc-0.0.4/include/sys/cdefs.h b/libc/include/sys/cdefs.h
index 366b0c6..366b0c6 100644
--- a/libc-0.0.4/include/sys/cdefs.h
+++ b/libc/include/sys/cdefs.h
diff --git a/libc-0.0.4/include/sys/errno.h b/libc/include/sys/errno.h
index 339f4fc..339f4fc 100644
--- a/libc-0.0.4/include/sys/errno.h
+++ b/libc/include/sys/errno.h
diff --git a/libc-0.0.4/include/sys/fcntl.h b/libc/include/sys/fcntl.h
index cd30455..cd30455 100644
--- a/libc-0.0.4/include/sys/fcntl.h
+++ b/libc/include/sys/fcntl.h
diff --git a/libc-0.0.4/include/sys/file.h b/libc/include/sys/file.h
index 2401b15..2401b15 100644
--- a/libc-0.0.4/include/sys/file.h
+++ b/libc/include/sys/file.h
diff --git a/libc-0.0.4/include/sys/ioctl.h b/libc/include/sys/ioctl.h
index 55e5882..55e5882 100644
--- a/libc-0.0.4/include/sys/ioctl.h
+++ b/libc/include/sys/ioctl.h
diff --git a/libc-0.0.4/include/sys/param.h b/libc/include/sys/param.h
index 1a31d1f..1a31d1f 100644
--- a/libc-0.0.4/include/sys/param.h
+++ b/libc/include/sys/param.h
diff --git a/libc-0.0.4/include/sys/signal.h b/libc/include/sys/signal.h
index 2e602da..2e602da 100644
--- a/libc-0.0.4/include/sys/signal.h
+++ b/libc/include/sys/signal.h
diff --git a/libc-0.0.4/include/sys/stat.h b/libc/include/sys/stat.h
index 4a4bdbd..4a4bdbd 100644
--- a/libc-0.0.4/include/sys/stat.h
+++ b/libc/include/sys/stat.h
diff --git a/libc-0.0.4/include/sys/types.h b/libc/include/sys/types.h
index 7b7de09..7b7de09 100644
--- a/libc-0.0.4/include/sys/types.h
+++ b/libc/include/sys/types.h
diff --git a/libc/include/sys/utsname.h b/libc/include/sys/utsname.h
new file mode 100644
index 0000000..0cbc37f
--- /dev/null
+++ b/libc/include/sys/utsname.h
@@ -0,0 +1,18 @@
+#ifndef __SYS_UTSNAME_H
+#define __SYS_UTSNAME_H
+
+#include <features.h>
+#include <sys/param.h>
+
+struct utsname {
+ char sysname[65];
+ char nodename[65];
+ char release[65];
+ char version[65];
+ char machine[65];
+ char domainname[65];
+};
+
+extern int uname __P ((struct utsname * __utsbuf));
+
+#endif
diff --git a/libc-0.0.4/include/sys/wait.h b/libc/include/sys/wait.h
index 70a0e4a..70a0e4a 100644
--- a/libc-0.0.4/include/sys/wait.h
+++ b/libc/include/sys/wait.h
diff --git a/libc-0.0.4/include/termcap.h b/libc/include/termcap.h
index a7ae37b..a7ae37b 100644
--- a/libc-0.0.4/include/termcap.h
+++ b/libc/include/termcap.h
diff --git a/libc-0.0.4/include/termio.h b/libc/include/termio.h
index 9e26956..9e26956 100644
--- a/libc-0.0.4/include/termio.h
+++ b/libc/include/termio.h
diff --git a/libc-0.0.4/include/termios.h b/libc/include/termios.h
index 4ca1ec8..4ca1ec8 100644
--- a/libc-0.0.4/include/termios.h
+++ b/libc/include/termios.h
diff --git a/libc-0.0.4/include/time.h b/libc/include/time.h
index b9eb87c..b9eb87c 100644
--- a/libc-0.0.4/include/time.h
+++ b/libc/include/time.h
diff --git a/libc-0.0.4/include/unistd.h b/libc/include/unistd.h
index c283a38..c96f710 100644
--- a/libc-0.0.4/include/unistd.h
+++ b/libc/include/unistd.h
@@ -17,6 +17,7 @@ extern int pipe __P ((int __pipedes[2]));
extern unsigned int alarm __P ((unsigned int __seconds));
extern unsigned int sleep __P ((unsigned int __seconds));
extern int pause __P ((void));
+extern char* crypt __P((__const char *__key, __const char *__salt));
#ifndef SEEK_SET
#define SEEK_SET 0
@@ -32,3 +33,5 @@ extern int pause __P ((void));
#endif
#endif /* __UNISTD_H */
+
+
diff --git a/libc-0.0.4/include/utime.h b/libc/include/utime.h
index 7f82b9f..7f82b9f 100644
--- a/libc-0.0.4/include/utime.h
+++ b/libc/include/utime.h
diff --git a/libc/include/utmp.h b/libc/include/utmp.h
new file mode 100644
index 0000000..9fe0e87
--- /dev/null
+++ b/libc/include/utmp.h
@@ -0,0 +1,52 @@
+/* utmp.h */
+
+#ifndef __UTMP_H
+#define __UTMP_H
+
+#include <features.h>
+#include <sys/types.h>
+#include <paths.h>
+#include <time.h>
+
+#define UT_UNKNOWN 0
+#define UT_LINESIZE 12
+#define UT_NAMESIZE 8
+#define UT_HOSTSIZE 16
+
+#define RUN_LVL 1
+#define BOOT_TIME 2
+#define NEW_TIME 3
+#define OLD_TIME 4
+
+#define INIT_PROCESS 5
+#define LOGIN_PROCESS 6
+#define USER_PROCESS 7
+#define DEAD_PROCESS 8
+
+struct utmp
+{
+ short ut_type; /* type of login */
+ pid_t ut_pid; /* pid of login-process */
+ char ut_line[UT_LINESIZE]; /* devicename of tty -"/dev/", null-term */
+ char ut_id[2]; /* abbrev. ttyname, as 01, s1 etc. */
+ time_t ut_time; /* login time */
+ char ut_user[UT_NAMESIZE]; /* username, not null-term */
+ char ut_host[UT_HOSTSIZE]; /* hostname for remote login... */
+ long ut_addr; /* IP addr of remote host */
+
+};
+
+extern void setutent __P ((void));
+extern void utmpname __P ((__const char *));
+extern struct utmp * getutent __P ((void));
+extern struct utmp * getutid __P ((struct utmp *));
+extern struct utmp * getutline __P ((struct utmp *));
+extern struct utmp * pututline __P ((struct utmp *));
+extern void endutent __P ((void));
+
+#ifdef __LIBC__
+struct utmp * __getutent __P ((int));
+#endif
+
+#endif /* __UTMP_H */
+
diff --git a/libc-0.0.4/include/varargs.h b/libc/include/varargs.h
index b5c647f..b5c647f 100644
--- a/libc-0.0.4/include/varargs.h
+++ b/libc/include/varargs.h
diff --git a/libc-0.0.4/kinclude/Config b/libc/kinclude/Config
index f3d064f..f3d064f 100644
--- a/libc-0.0.4/kinclude/Config
+++ b/libc/kinclude/Config
diff --git a/libc/kinclude/Makefile b/libc/kinclude/Makefile
new file mode 100644
index 0000000..79dd5c2
--- /dev/null
+++ b/libc/kinclude/Makefile
@@ -0,0 +1,18 @@
+# Copyright (C) 1995,1996 Robert de Bath <rdebath@cix.compulink.co.uk>
+# This file is part of the Linux-8086 C library and is distributed
+# under the GNU Library General Public License.
+
+TOP=..
+include $(TOP)/Make.defs
+
+OBJ=
+
+all: $(OBJ)
+
+libc.a:
+
+transfer:
+ -@rm -f ../include/linuxmt
+ ln -s ../kinclude/linuxmt ../include
+
+clean:
diff --git a/libc-0.0.4/kinclude/arch/errno.h b/libc/kinclude/arch/errno.h
index ee3fcab..ee3fcab 100644
--- a/libc-0.0.4/kinclude/arch/errno.h
+++ b/libc/kinclude/arch/errno.h
diff --git a/libc-0.0.4/kinclude/arch/ioctl.h b/libc/kinclude/arch/ioctl.h
index 55b276b..55b276b 100644
--- a/libc-0.0.4/kinclude/arch/ioctl.h
+++ b/libc/kinclude/arch/ioctl.h
diff --git a/libc-0.0.4/kinclude/arch/types.h b/libc/kinclude/arch/types.h
index d6690d1..d6690d1 100644
--- a/libc-0.0.4/kinclude/arch/types.h
+++ b/libc/kinclude/arch/types.h
diff --git a/libc-0.0.4/kinclude/linuxmt/errno.h b/libc/kinclude/linuxmt/errno.h
index b4c07a3..b4c07a3 100644
--- a/libc-0.0.4/kinclude/linuxmt/errno.h
+++ b/libc/kinclude/linuxmt/errno.h
diff --git a/libc-0.0.4/kinclude/linuxmt/fcntl.h b/libc/kinclude/linuxmt/fcntl.h
index d9188a1..d9188a1 100644
--- a/libc-0.0.4/kinclude/linuxmt/fcntl.h
+++ b/libc/kinclude/linuxmt/fcntl.h
diff --git a/libc-0.0.4/kinclude/linuxmt/ioctl.h b/libc/kinclude/linuxmt/ioctl.h
index 20f5ac6..20f5ac6 100644
--- a/libc-0.0.4/kinclude/linuxmt/ioctl.h
+++ b/libc/kinclude/linuxmt/ioctl.h
diff --git a/libc-0.0.4/kinclude/linuxmt/stat.h b/libc/kinclude/linuxmt/stat.h
index 0eb1c0e..0eb1c0e 100644
--- a/libc-0.0.4/kinclude/linuxmt/stat.h
+++ b/libc/kinclude/linuxmt/stat.h
diff --git a/libc-0.0.4/kinclude/linuxmt/termios.h b/libc/kinclude/linuxmt/termios.h
index 52bde9a..52bde9a 100644
--- a/libc-0.0.4/kinclude/linuxmt/termios.h
+++ b/libc/kinclude/linuxmt/termios.h
diff --git a/libc-0.0.4/kinclude/linuxmt/types.h b/libc/kinclude/linuxmt/types.h
index b38f81c..437d985 100644
--- a/libc-0.0.4/kinclude/linuxmt/types.h
+++ b/libc/kinclude/linuxmt/types.h
@@ -21,6 +21,7 @@ typedef __u16 umode_t;
typedef __u16 nlink_t;
typedef __u16 mode_t;
typedef __u32 loff_t;
+typedef unsigned int speed_t;
typedef __u16 dev_t;
typedef __u16 ino_t;
diff --git a/libc-0.0.4/libc.a b/libc/libc.a
index a02a759..9c13df0 100644
--- a/libc-0.0.4/libc.a
+++ b/libc/libc.a
Binary files differ
diff --git a/libc-0.0.4/malloc1/Config b/libc/malloc1/Config
index 4404398..4404398 100644
--- a/libc-0.0.4/malloc1/Config
+++ b/libc/malloc1/Config
diff --git a/libc-0.0.4/malloc1/Makefile b/libc/malloc1/Makefile
index d4aa9cf..6322454 100644
--- a/libc-0.0.4/malloc1/Makefile
+++ b/libc/malloc1/Makefile
@@ -9,12 +9,12 @@ OBJ=$(AOBJ)
all: $(OBJ)
-$(LIBC): $(OBJ)
+libc.a: $(OBJ)
ar r ../$(LIBC) $(OBJ)
@touch libc.a
clean:
- rm -f $(OBJ) libc.a
+ rm -f *.o libc.a
$(AOBJ): $(ASRC)
$(CC) $(CFLAGS) -c -DL_$* -o $@ $(ASRC)
diff --git a/libc-0.0.4/malloc1/README b/libc/malloc1/README
index 95f5928..95f5928 100644
--- a/libc-0.0.4/malloc1/README
+++ b/libc/malloc1/README
diff --git a/libc-0.0.4/malloc1/malloc.c b/libc/malloc1/malloc.c
index 687a84b..91912f7 100644
--- a/libc-0.0.4/malloc1/malloc.c
+++ b/libc/malloc1/malloc.c
@@ -38,14 +38,14 @@ mem;
#define m_next(p) ((p) [1].next) /* For malloc and alloca */
#define m_deep(p) ((p) [0].depth) /* For alloca */
-extern void *__mini_malloc __P ((unsigned int));
-extern void *(*__alloca_alloc) __P ((unsigned int));
+extern void *__mini_malloc __P ((size_t));
+extern void *(*__alloca_alloc) __P ((size_t));
extern mem *__freed_list;
#ifdef L_free
/* Start the alloca with just the dumb version of malloc */
-void *(*__alloca_alloc) __P ((unsigned int)) = __mini_malloc;
+void *(*__alloca_alloc) __P ((size_t)) = __mini_malloc;
mem *__freed_list = 0;
#ifdef VERBOSE
@@ -82,7 +82,7 @@ static mem *alloca_stack = 0;
void *
alloca(size)
-unsigned size;
+size_t size;
{
auto char probe; /* Probes stack depth: */
register mem *hp;
@@ -176,7 +176,7 @@ void *ptr;
void *
__mini_malloc(size)
-unsigned int size;
+size_t size;
{
register mem *ptr;
register unsigned int sz;
@@ -221,7 +221,7 @@ static mem *search_chunk();
void *
malloc(size)
-unsigned int size;
+size_t size;
{
register mem *ptr = 0;
register unsigned int sz;
@@ -514,7 +514,7 @@ unsigned int elm, sz;
void *
realloc(ptr, size)
void *ptr;
-unsigned int size;
+size_t size;
{
void *nptr;
unsigned int osize;
diff --git a/libc-0.0.4/malloc1/malloc.h b/libc/malloc1/malloc.h
index c00fa21..e8fdb0a 100644
--- a/libc-0.0.4/malloc1/malloc.h
+++ b/libc/malloc1/malloc.h
@@ -2,6 +2,7 @@
#ifndef __MALLOC_H
#define __MALLOC_H
#include <features.h>
+#include <sys/types.h>
/*
* Mini malloc allows you to use a less efficient but smaller malloc the
@@ -11,12 +12,12 @@
*
*/
-void free __P((void *));
-void *malloc __P((unsigned int));
-void *realloc __P((void *, unsigned int));
-void *alloca __P((unsigned int));
+extern void free __P((void *));
+extern void *malloc __P((size_t));
+extern void *realloc __P((void *, size_t));
+extern void *alloca __P((size_t));
-extern void *(*__alloca_alloc) __P((unsigned int));
+extern void *(*__alloca_alloc) __P((size_t));
#ifdef __LIBC__
#define __MINI_MALLOC__
diff --git a/libc-0.0.4/malloc2/Config b/libc/malloc2/Config
index 11c476d..11c476d 100644
--- a/libc-0.0.4/malloc2/Config
+++ b/libc/malloc2/Config
diff --git a/libc-0.0.4/malloc2/makefile b/libc/malloc2/Makefile
index 8678d62..0396df2 100644
--- a/libc-0.0.4/malloc2/makefile
+++ b/libc/malloc2/Makefile
@@ -9,7 +9,7 @@ OBJ=$(MOBJ)
all: $(OBJ)
libc.a: $(OBJ)
- ar r ../libc.a $(OBJ)
+ ar r ../$(LIBC) $(OBJ)
@touch libc.a
clean:
diff --git a/libc-0.0.4/malloc2/README b/libc/malloc2/README
index ecf3fd2..ecf3fd2 100644
--- a/libc-0.0.4/malloc2/README
+++ b/libc/malloc2/README
diff --git a/libc-0.0.4/malloc2/malloc.c b/libc/malloc2/malloc.c
index 143d324..143d324 100644
--- a/libc-0.0.4/malloc2/malloc.c
+++ b/libc/malloc2/malloc.c
diff --git a/libc-0.0.4/malloc2/malloc.h b/libc/malloc2/malloc.h
index ffcb3a4..ffcb3a4 100644
--- a/libc-0.0.4/malloc2/malloc.h
+++ b/libc/malloc2/malloc.h
diff --git a/libc-0.0.4/malloc2/stack.c b/libc/malloc2/stack.c
index 5f33e21..5f33e21 100644
--- a/libc-0.0.4/malloc2/stack.c
+++ b/libc/malloc2/stack.c
diff --git a/libc-0.0.4/misc/Config b/libc/misc/Config
index 9ede0c2..9ede0c2 100644
--- a/libc-0.0.4/misc/Config
+++ b/libc/misc/Config
diff --git a/libc-0.0.4/misc/Makefile b/libc/misc/Makefile
index b136fc4..87ad1e5 100644
--- a/libc-0.0.4/misc/Makefile
+++ b/libc/misc/Makefile
@@ -15,7 +15,7 @@ OBJ=$(MOBJ) $(EOBJ) \
atoi.o atol.o ltoa.o ltostr.o \
ctype.o qsort.o bsearch.o rand.o lsearch.o getopt.o \
getenv.o putenv.o itoa.o cputype.o \
- strtol.o popen.o system.o
+ strtol.o popen.o system.o crypt.o
# No ELKS strtod() until BCC does 16 bit FP...
ifeq ($(PLATFORM),i386-Linux)
@@ -24,12 +24,12 @@ endif
all: $(OBJ)
-$(LIBC): $(OBJ)
+libc.a: $(OBJ)
ar r ../$(LIBC) $(OBJ)
@touch libc.a
clean:
- rm -f $(OBJ) libc.a
+ rm -f *.o libc.a
$(MOBJ): $(MSRC)
$(CC) $(CFLAGS) -c -DL_$* -o $@ $(MSRC)
@@ -37,6 +37,13 @@ $(MOBJ): $(MSRC)
$(EOBJ): $(ESRC)
$(CC) $(CFLAGS) -c -DL_$* -o $@ $(ESRC)
+crypt.o: crypt.c
+ifeq ($(PLATFORM),i386-Linux)
+ $(CC) $(CFLAGS) $< -c -o $@ $(WALL)
+else
+ $(CC) $(CFLAGS) $< -c -o $@ -ansi
+endif
+
strto%.o: strto%.c
ifeq ($(PLATFORM),i386-Linux)
$(CC) $(CFLAGS) $< -c -o $@ $(WALL)
diff --git a/libc-0.0.4/misc/aliases.c b/libc/misc/aliases.c
index 466cb74..466cb74 100644
--- a/libc-0.0.4/misc/aliases.c
+++ b/libc/misc/aliases.c
diff --git a/libc-0.0.4/misc/atexit.c b/libc/misc/atexit.c
index 6e8e45b..6e8e45b 100644
--- a/libc-0.0.4/misc/atexit.c
+++ b/libc/misc/atexit.c
diff --git a/libc-0.0.4/misc/atoi.c b/libc/misc/atoi.c
index 5272646..5272646 100644
--- a/libc-0.0.4/misc/atoi.c
+++ b/libc/misc/atoi.c
diff --git a/libc-0.0.4/misc/atol.c b/libc/misc/atol.c
index 901dfe2..901dfe2 100644
--- a/libc-0.0.4/misc/atol.c
+++ b/libc/misc/atol.c
diff --git a/libc-0.0.4/misc/bsearch.c b/libc/misc/bsearch.c
index 9898667..9898667 100644
--- a/libc-0.0.4/misc/bsearch.c
+++ b/libc/misc/bsearch.c
diff --git a/libc-0.0.4/misc/cputype.c b/libc/misc/cputype.c
index 642edf6..642edf6 100644
--- a/libc-0.0.4/misc/cputype.c
+++ b/libc/misc/cputype.c
diff --git a/libc/misc/crypt.c b/libc/misc/crypt.c
new file mode 100644
index 0000000..906dea2
--- /dev/null
+++ b/libc/misc/crypt.c
@@ -0,0 +1,50 @@
+#include <features.h>
+#include <stdlib.h>
+/* TEA based crypt(), version 0.0 <ndf@linux.mit.edu>
+ * It looks like there are problems with key bits carrying through
+ * to the encryted data, and I want to get rid of that libc call..
+ * This is just so rob could see it ;) */
+char *
+crypt(const char * key, const char * salt)
+{
+ /* n is the number of rounds, delta is a golden # derivative,
+ k is the key, v is the data to be encrypted. */
+ unsigned long v[2], sum=0, delta=0x9e3779b9, n=64, k[4];
+ static char rkey[16];
+ unsigned char i;
+
+ /* Our constant string will be a string of zeros .. */
+ v[0]=v[1]=k[0]=k[1]=k[2]=k[3]=0;
+ for(i=0;i<16;i++) rkey[i]=0;
+ rkey[0]=*salt;
+ rkey[1]=salt[1];
+ for (i=0;key[i];i++) rkey[i+1]=key[i];
+ memcpy(k, rkey, 4*sizeof(long));
+
+ while (n-->0) {
+ sum += delta;
+ v[0] += (v[1]<<4)+k[0] ^ v[1]+sum ^ (v[1]>>5)+k[1];
+ v[1] += (v[0]<<4)+k[2] ^ v[0]+sum ^ (v[0]>>5)+k[3];
+ }
+
+ *rkey=*salt; rkey[1]=salt[1];
+
+ /* Now we need to unpack the bits and map it to "A-Za-z0-9./" for printing
+ in /etc/passwd */
+ for (i=2;i<13;i++)
+ {
+ /* This unpacks the 6 bit data, each cluster into its own byte */
+ if (i==8) v[0]|=v[1]>>28;
+ rkey[i]=v[(i-2)/6]&0x3F;
+ v[(i-2)/6]>>=6;
+
+ /* Now we map to the proper chars */
+ if (rkey[i]>=0 && rkey[i]<12) rkey[i]+=46;
+ else if (rkey[i]>11 && rkey[i]<38) rkey[i]+=53;
+ else if (rkey[i]>37 && rkey[i]<64) rkey[i]+=59;
+ else return NULL;
+ }
+
+ rkey[13]='\0';
+ return rkey;
+}
diff --git a/libc-0.0.4/misc/ctype.c b/libc/misc/ctype.c
index 1514668..1514668 100644
--- a/libc-0.0.4/misc/ctype.c
+++ b/libc/misc/ctype.c
diff --git a/libc-0.0.4/misc/getenv.c b/libc/misc/getenv.c
index 45d072e..45d072e 100644
--- a/libc-0.0.4/misc/getenv.c
+++ b/libc/misc/getenv.c
diff --git a/libc-0.0.4/misc/getopt.c b/libc/misc/getopt.c
index d951214..d951214 100644
--- a/libc-0.0.4/misc/getopt.c
+++ b/libc/misc/getopt.c
diff --git a/libc-0.0.4/misc/itoa.c b/libc/misc/itoa.c
index 0822cfc..0822cfc 100644
--- a/libc-0.0.4/misc/itoa.c
+++ b/libc/misc/itoa.c
diff --git a/libc-0.0.4/misc/lsearch.c b/libc/misc/lsearch.c
index f3253e9..f3253e9 100644
--- a/libc-0.0.4/misc/lsearch.c
+++ b/libc/misc/lsearch.c
diff --git a/libc-0.0.4/misc/ltoa.c b/libc/misc/ltoa.c
index be1c7e2..be1c7e2 100644
--- a/libc-0.0.4/misc/ltoa.c
+++ b/libc/misc/ltoa.c
diff --git a/libc-0.0.4/misc/ltostr.c b/libc/misc/ltostr.c
index c8966d9..c8966d9 100644
--- a/libc-0.0.4/misc/ltostr.c
+++ b/libc/misc/ltostr.c
diff --git a/libc-0.0.4/misc/popen.c b/libc/misc/popen.c
index c848ca4..c848ca4 100644
--- a/libc-0.0.4/misc/popen.c
+++ b/libc/misc/popen.c
diff --git a/libc-0.0.4/misc/putenv.c b/libc/misc/putenv.c
index 09a68d6..09a68d6 100644
--- a/libc-0.0.4/misc/putenv.c
+++ b/libc/misc/putenv.c
diff --git a/libc-0.0.4/misc/qsort.c b/libc/misc/qsort.c
index cee53c3..cee53c3 100644
--- a/libc-0.0.4/misc/qsort.c
+++ b/libc/misc/qsort.c
diff --git a/libc-0.0.4/misc/rand.c b/libc/misc/rand.c
index 4eb0789..4eb0789 100644
--- a/libc-0.0.4/misc/rand.c
+++ b/libc/misc/rand.c
diff --git a/libc-0.0.4/misc/strtod.c b/libc/misc/strtod.c
index 8acb423..8acb423 100644
--- a/libc-0.0.4/misc/strtod.c
+++ b/libc/misc/strtod.c
diff --git a/libc-0.0.4/misc/strtol.c b/libc/misc/strtol.c
index bcd3334..bcd3334 100644
--- a/libc-0.0.4/misc/strtol.c
+++ b/libc/misc/strtol.c
diff --git a/libc-0.0.4/misc/system.c b/libc/misc/system.c
index f48f68d..f48f68d 100644
--- a/libc-0.0.4/misc/system.c
+++ b/libc/misc/system.c
diff --git a/libc-0.0.4/msdos/Config b/libc/msdos/Config
index ec28084..ec28084 100644
--- a/libc-0.0.4/msdos/Config
+++ b/libc/msdos/Config
diff --git a/libc-0.0.4/msdos/Makefile b/libc/msdos/Makefile
index d94d733..2dd3497 100644
--- a/libc-0.0.4/msdos/Makefile
+++ b/libc/msdos/Makefile
@@ -13,20 +13,20 @@ AOBJ= dos_start.o __mkargv.o dos__fconv.o dos_read.o dos_write.o \
BSRC=i86.c
BOBJ= __set_es.o __peek_es.o __poke_es.o __deek_es.o __strchr_es.o
+ifeq ($(PLATFORM),i86-DOS)
OBJ=$(AOBJ) $(BOBJ)
+else
+OBJ=$(BOBJ)
+endif
all: $(OBJ)
-libc.a: $(BOBJ)
- ar r ../$(LIBC) $(BOBJ)
- @touch libc.a
-
-libdos.a: $(OBJ)
+libc.a: $(OBJ)
ar r ../$(LIBC) $(OBJ)
@touch libc.a
clean:
- rm -f $(OBJ) libc.a
+ rm -f *.o libc.a
$(AOBJ): $(ASRC)
$(CC) $(CFLAGS) -c -DL_$* -o $@ $(ASRC)
diff --git a/libc-0.0.4/msdos/TODO b/libc/msdos/Notes
index b775dff..b775dff 100644
--- a/libc-0.0.4/msdos/TODO
+++ b/libc/msdos/Notes
diff --git a/libc-0.0.4/msdos/i86.c b/libc/msdos/i86.c
index 0613756..0613756 100644
--- a/libc-0.0.4/msdos/i86.c
+++ b/libc/msdos/i86.c
diff --git a/libc-0.0.4/msdos/msdos.c b/libc/msdos/msdos.c
index 02c35db..02c35db 100644
--- a/libc-0.0.4/msdos/msdos.c
+++ b/libc/msdos/msdos.c
diff --git a/libc-0.0.4/pwd/Config b/libc/pwd/Config
index b5aaad0..b5aaad0 100644
--- a/libc-0.0.4/pwd/Config
+++ b/libc/pwd/Config
diff --git a/libc-0.0.4/pwd/Makefile b/libc/pwd/Makefile
index df90f89..a31ac02 100644
--- a/libc-0.0.4/pwd/Makefile
+++ b/libc/pwd/Makefile
@@ -19,7 +19,7 @@ all: $(POBJ)
%.o: %.c
$(CC) $(CFLAGS) -o $@ $< -c
-$(LIBC): $(POBJ)
+libc.a: $(POBJ)
ar r ../$(LIBC) $(POBJ)
@touch libc.a
@@ -33,7 +33,7 @@ libpwd.a: $(POBJ)
libpwd: libpwd.a
clean:
- rm -f $(POBJ) libc.a libpwd.a
+ rm -f *.o libc.a libpwd.a
diff --git a/libc/pwd/__getpwent.c b/libc/pwd/__getpwent.c
new file mode 100644
index 0000000..9836ca7
--- /dev/null
+++ b/libc/pwd/__getpwent.c
@@ -0,0 +1,99 @@
+/*
+ * __getpwent.c - This file is part of the libc-8086/pwd package for ELKS,
+ * Copyright (C) 1995, 1996 Nat Friedman <ndf@linux.mit.edu>.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <fcntl.h>
+#include <pwd.h>
+
+#define PWD_BUFFER_SIZE 256
+
+/* This isn't as flash as my previous version -- it doesn't dynamically
+ scale down the gecos on too-long lines, but it also makes fewer syscalls,
+ so it's probably nicer. Write me if you want the old version. Maybe I
+ should include it as a build-time option... ?
+ -Nat <ndf@linux.mit.edu> */
+
+struct passwd *
+__getpwent(int pwd_fd)
+{
+ static char line_buff[PWD_BUFFER_SIZE];
+ static struct passwd passwd;
+ char * field_begin;
+ char * endptr;
+ char * gid_ptr;
+ char * uid_ptr;
+ int line_len;
+ int i;
+
+ /* We use the restart label to handle malformatted lines */
+restart:
+ /* Read the passwd line into the static buffer using a minimal of
+ syscalls. */
+ if ((line_len=read(pwd_fd, line_buff, PWD_BUFFER_SIZE))<=0)
+ return NULL;
+ field_begin=strchr(line_buff, '\n');
+ if (field_begin!=NULL)
+ lseek(pwd_fd, (long) (1+field_begin-(line_buff+line_len)), SEEK_CUR);
+ else /* The line is too long - skip it. :-\ */
+ {
+ do { if ((line_len=read(pwd_fd, line_buff, PWD_BUFFER_SIZE))<=0)
+ return NULL;
+ } while (!(field_begin=strchr(line_buff, '\n')));
+ lseek(pwd_fd, (long) (field_begin-line_buff)-line_len+1, SEEK_CUR);
+ goto restart;
+ }
+ if (*line_buff=='#' || *line_buff==' ' || *line_buff=='\n' ||
+ *line_buff=='\t')
+ goto restart;
+ *field_begin='\0';
+
+ /* We've read the line; now parse it. */
+ field_begin=line_buff;
+ for (i=0;i<7;i++)
+ {
+ switch(i)
+ {
+ case 0: passwd.pw_name=field_begin; break;
+ case 1: passwd.pw_passwd=field_begin; break;
+ case 2: uid_ptr=field_begin; break;
+ case 3: gid_ptr=field_begin; break;
+ case 4: passwd.pw_gecos=field_begin; break;
+ case 5: passwd.pw_dir=field_begin; break;
+ case 6: passwd.pw_shell=field_begin; break;
+ }
+ if (i<6)
+ {
+ field_begin=strchr(field_begin, ':');
+ if (field_begin==NULL) goto restart;
+ *field_begin++='\0';
+ }
+ }
+ passwd.pw_gid=(gid_t) strtoul(gid_ptr, &endptr, 10);
+ if (*endptr!='\0') goto restart;
+
+ passwd.pw_uid=(uid_t) strtoul(uid_ptr, &endptr, 10);
+ if (*endptr!='\0') goto restart;
+
+ return &passwd;
+}
+
+
diff --git a/libc-0.0.4/pwd/fgetpwent.c b/libc/pwd/fgetpwent.c
index e12b890..e12b890 100644
--- a/libc-0.0.4/pwd/fgetpwent.c
+++ b/libc/pwd/fgetpwent.c
diff --git a/libc-0.0.4/pwd/getpw.c b/libc/pwd/getpw.c
index 4f4e390..4f4e390 100644
--- a/libc-0.0.4/pwd/getpw.c
+++ b/libc/pwd/getpw.c
diff --git a/libc-0.0.4/pwd/getpwnam.c b/libc/pwd/getpwnam.c
index 85dbc8e..85dbc8e 100644
--- a/libc-0.0.4/pwd/getpwnam.c
+++ b/libc/pwd/getpwnam.c
diff --git a/libc-0.0.4/pwd/getpwuid.c b/libc/pwd/getpwuid.c
index ffd58c1..ffd58c1 100644
--- a/libc-0.0.4/pwd/getpwuid.c
+++ b/libc/pwd/getpwuid.c
diff --git a/libc-0.0.4/pwd/putpwent.c b/libc/pwd/putpwent.c
index a0035ea..a0035ea 100644
--- a/libc-0.0.4/pwd/putpwent.c
+++ b/libc/pwd/putpwent.c
diff --git a/libc-0.0.4/pwd/pwent.c b/libc/pwd/pwent.c
index dc40a08..fd65db2 100644
--- a/libc-0.0.4/pwd/pwent.c
+++ b/libc/pwd/pwent.c
@@ -31,7 +31,7 @@
*/
/* file descriptor for the password file currently open */
-static int pw_fd;
+static int pw_fd = -1;
void
setpwent(void)
diff --git a/libc-0.0.4/pwd/test_pwd.c b/libc/pwd/test_pwd.c
index 3279fb2..74f7657 100644
--- a/libc-0.0.4/pwd/test_pwd.c
+++ b/libc/pwd/test_pwd.c
@@ -53,7 +53,7 @@ main(int argc, char ** argv)
fprintf(stderr, "=> Testing getpwuid(), getpwnam()...\n");
fprintf(stderr, "-> getpwuid()...\n");
printf("********************************************************************************\n");
- for(test_uid=0;test_uid<100;test_uid++)
+ for(test_uid=0;test_uid<1000;test_uid++)
{
fprintf(stderr, "-> getpwuid(%d)...\n", test_uid);
passwd=getpwuid((uid_t) test_uid);
@@ -66,8 +66,8 @@ main(int argc, char ** argv)
printf("pw_gecos\t: %s\n", passwd->pw_gecos);
printf("pw_dir\t\t: %s\n", passwd->pw_dir);
printf("pw_shell\t: %s\n", passwd->pw_shell);
- }
printf("********************************************************************************\n");
+ }
}
fprintf(stderr, "-> getpwnam()...\n");
passwd=getpwnam("root");
diff --git a/libc-0.0.4/regexp/Config b/libc/regexp/Config
index bd644a6..bd644a6 100644
--- a/libc-0.0.4/regexp/Config
+++ b/libc/regexp/Config
diff --git a/libc-0.0.4/regexp/Makefile b/libc/regexp/Makefile
index b330451..71c2b81 100644
--- a/libc-0.0.4/regexp/Makefile
+++ b/libc/regexp/Makefile
@@ -13,7 +13,7 @@ test: try tests
@echo 'No news is good news...'
try <tests
-$(LIBC): $(OBJ)
+libc.a: $(OBJ)
ar r ../$(LIBC) $(OBJ)
@touch libc.a
diff --git a/libc-0.0.4/regexp/Makefile.org b/libc/regexp/Makefile.org
index a8be06e..a8be06e 100644
--- a/libc-0.0.4/regexp/Makefile.org
+++ b/libc/regexp/Makefile.org
diff --git a/libc-0.0.4/regexp/README b/libc/regexp/README
index 37d6f51..37d6f51 100644
--- a/libc-0.0.4/regexp/README
+++ b/libc/regexp/README
diff --git a/libc-0.0.4/regexp/README.rdb b/libc/regexp/README.rdb
index 1c3bba6..1c3bba6 100644
--- a/libc-0.0.4/regexp/README.rdb
+++ b/libc/regexp/README.rdb
diff --git a/libc-0.0.4/regexp/patch.1 b/libc/regexp/patch.1
index 6126592..6126592 100644
--- a/libc-0.0.4/regexp/patch.1
+++ b/libc/regexp/patch.1
diff --git a/libc-0.0.4/regexp/patch.2 b/libc/regexp/patch.2
index fcf4778..fcf4778 100644
--- a/libc-0.0.4/regexp/patch.2
+++ b/libc/regexp/patch.2
diff --git a/libc-0.0.4/regexp/patch.3 b/libc/regexp/patch.3
index 36bafd4..36bafd4 100644
--- a/libc-0.0.4/regexp/patch.3
+++ b/libc/regexp/patch.3
diff --git a/libc-0.0.4/regexp/patch.4 b/libc/regexp/patch.4
index 4d8ea3a..4d8ea3a 100644
--- a/libc-0.0.4/regexp/patch.4
+++ b/libc/regexp/patch.4
diff --git a/libc-0.0.4/regexp/regerror.c b/libc/regexp/regerror.c
index 63864c7..63864c7 100644
--- a/libc-0.0.4/regexp/regerror.c
+++ b/libc/regexp/regerror.c
diff --git a/libc-0.0.4/regexp/regexp.3 b/libc/regexp/regexp.3
index c0e29ea..c0e29ea 100644
--- a/libc-0.0.4/regexp/regexp.3
+++ b/libc/regexp/regexp.3
diff --git a/libc-0.0.4/regexp/regexp.c b/libc/regexp/regexp.c
index 860b485..860b485 100644
--- a/libc-0.0.4/regexp/regexp.c
+++ b/libc/regexp/regexp.c
diff --git a/libc-0.0.4/regexp/regexp.h b/libc/regexp/regexp.h
index 73d6bf4..73d6bf4 100644
--- a/libc-0.0.4/regexp/regexp.h
+++ b/libc/regexp/regexp.h
diff --git a/libc-0.0.4/regexp/regmagic.h b/libc/regexp/regmagic.h
index 5acf447..5acf447 100644
--- a/libc-0.0.4/regexp/regmagic.h
+++ b/libc/regexp/regmagic.h
diff --git a/libc-0.0.4/regexp/regsub.c b/libc/regexp/regsub.c
index 5ca5676..5ca5676 100644
--- a/libc-0.0.4/regexp/regsub.c
+++ b/libc/regexp/regsub.c
diff --git a/libc-0.0.4/regexp/tests b/libc/regexp/tests
index e5bc16d..e5bc16d 100644
--- a/libc-0.0.4/regexp/tests
+++ b/libc/regexp/tests
diff --git a/libc-0.0.4/regexp/timer.c b/libc/regexp/timer.c
index 2d84a12..2d84a12 100644
--- a/libc-0.0.4/regexp/timer.c
+++ b/libc/regexp/timer.c
diff --git a/libc-0.0.4/regexp/try.c b/libc/regexp/try.c
index 71620c2..71620c2 100644
--- a/libc-0.0.4/regexp/try.c
+++ b/libc/regexp/try.c
diff --git a/libc-0.0.4/stdio1/BUGS b/libc/stdio1/BUGS
index 0e8e0db..0e8e0db 100644
--- a/libc-0.0.4/stdio1/BUGS
+++ b/libc/stdio1/BUGS
diff --git a/libc-0.0.4/stdio1/Config b/libc/stdio1/Config
index 3b3b35f..3b3b35f 100644
--- a/libc-0.0.4/stdio1/Config
+++ b/libc/stdio1/Config
diff --git a/libc-0.0.4/stdio1/makefile b/libc/stdio1/Makefile
index 0723b97..d8058b0 100644
--- a/libc-0.0.4/stdio1/makefile
+++ b/libc/stdio1/Makefile
@@ -17,7 +17,7 @@ endif
all: $(OBJ)
libc.a: $(OBJ)
- ar r ../libc.a $(OBJ)
+ ar r ../$(LIBC) $(OBJ)
@touch libc.a
$(OBJ): stdio.h
@@ -29,7 +29,7 @@ test: test.o $(OBJ)
$(CC) $(CFLAGS) -o $@ $< -c
clean:
- rm -f *.o test
+ rm -f *.o test libc.a
transfer:
-@rm -f ../include/stdio.h
diff --git a/libc-0.0.4/stdio1/NOTICE b/libc/stdio1/NOTICE
index 25ca5b6..25ca5b6 100644
--- a/libc-0.0.4/stdio1/NOTICE
+++ b/libc/stdio1/NOTICE
diff --git a/libc-0.0.4/stdio1/README b/libc/stdio1/README
index 5dc59aa..5dc59aa 100644
--- a/libc-0.0.4/stdio1/README
+++ b/libc/stdio1/README
diff --git a/libc-0.0.4/stdio1/TODO b/libc/stdio1/TODO
index 481f6d9..481f6d9 100644
--- a/libc-0.0.4/stdio1/TODO
+++ b/libc/stdio1/TODO
diff --git a/libc-0.0.4/stdio1/__ffillbuf.c b/libc/stdio1/__ffillbuf.c
index e705cbf..e705cbf 100644
--- a/libc-0.0.4/stdio1/__ffillbuf.c
+++ b/libc/stdio1/__ffillbuf.c
diff --git a/libc-0.0.4/stdio1/__stdio_init.c b/libc/stdio1/__stdio_init.c
index b49bb28..b49bb28 100644
--- a/libc-0.0.4/stdio1/__stdio_init.c
+++ b/libc/stdio1/__stdio_init.c
diff --git a/libc-0.0.4/stdio1/fclose.c b/libc/stdio1/fclose.c
index 7ec233e..7ec233e 100644
--- a/libc-0.0.4/stdio1/fclose.c
+++ b/libc/stdio1/fclose.c
diff --git a/libc-0.0.4/stdio1/fcntl.h b/libc/stdio1/fcntl.h
index 69fdb90..69fdb90 100644
--- a/libc-0.0.4/stdio1/fcntl.h
+++ b/libc/stdio1/fcntl.h
diff --git a/libc-0.0.4/stdio1/fflush.c b/libc/stdio1/fflush.c
index c9cdac7..c9cdac7 100644
--- a/libc-0.0.4/stdio1/fflush.c
+++ b/libc/stdio1/fflush.c
diff --git a/libc-0.0.4/stdio1/fgetc.c b/libc/stdio1/fgetc.c
index 2c41062..2c41062 100644
--- a/libc-0.0.4/stdio1/fgetc.c
+++ b/libc/stdio1/fgetc.c
diff --git a/libc-0.0.4/stdio1/fgets.c b/libc/stdio1/fgets.c
index c085970..c085970 100644
--- a/libc-0.0.4/stdio1/fgets.c
+++ b/libc/stdio1/fgets.c
diff --git a/libc-0.0.4/stdio1/fopen.c b/libc/stdio1/fopen.c
index 1265ff5..1265ff5 100644
--- a/libc-0.0.4/stdio1/fopen.c
+++ b/libc/stdio1/fopen.c
diff --git a/libc-0.0.4/stdio1/fputc.c b/libc/stdio1/fputc.c
index 939a721..939a721 100644
--- a/libc-0.0.4/stdio1/fputc.c
+++ b/libc/stdio1/fputc.c
diff --git a/libc-0.0.4/stdio1/fputs.c b/libc/stdio1/fputs.c
index 41e2998..41e2998 100644
--- a/libc-0.0.4/stdio1/fputs.c
+++ b/libc/stdio1/fputs.c
diff --git a/libc-0.0.4/stdio1/idealgetline.c b/libc/stdio1/idealgetline.c
index 7eacc9e..7eacc9e 100644
--- a/libc-0.0.4/stdio1/idealgetline.c
+++ b/libc/stdio1/idealgetline.c
diff --git a/libc-0.0.4/stdio1/old_printf.c b/libc/stdio1/old_printf.c
index 81d62ac..81d62ac 100644
--- a/libc-0.0.4/stdio1/old_printf.c
+++ b/libc/stdio1/old_printf.c
diff --git a/libc-0.0.4/stdio1/printf.c b/libc/stdio1/printf.c
index f2a39bd..f2a39bd 100644
--- a/libc-0.0.4/stdio1/printf.c
+++ b/libc/stdio1/printf.c
diff --git a/libc-0.0.4/stdio1/puts.c b/libc/stdio1/puts.c
index d9bb8d0..d9bb8d0 100644
--- a/libc-0.0.4/stdio1/puts.c
+++ b/libc/stdio1/puts.c
diff --git a/libc-0.0.4/stdio1/scanf.c b/libc/stdio1/scanf.c
index 81900a1..81900a1 100644
--- a/libc-0.0.4/stdio1/scanf.c
+++ b/libc/stdio1/scanf.c
diff --git a/libc-0.0.4/stdio1/stdio.h b/libc/stdio1/stdio.h
index 4bd1989..4bd1989 100644
--- a/libc-0.0.4/stdio1/stdio.h
+++ b/libc/stdio1/stdio.h
diff --git a/libc-0.0.4/stdio1/test.sh b/libc/stdio1/test.sh
index 9d872dc..9d872dc 100755
--- a/libc-0.0.4/stdio1/test.sh
+++ b/libc/stdio1/test.sh
diff --git a/libc-0.0.4/stdio2/Config b/libc/stdio2/Config
index 665045f..665045f 100644
--- a/libc-0.0.4/stdio2/Config
+++ b/libc/stdio2/Config
diff --git a/libc-0.0.4/stdio2/Makefile b/libc/stdio2/Makefile
index 51c48c1..56b9862 100644
--- a/libc-0.0.4/stdio2/Makefile
+++ b/libc/stdio2/Makefile
@@ -17,7 +17,7 @@ OBJ= $(AOBJ) $(POBJ) $(SOBJ)
all: $(OBJ)
-$(LIBC): $(OBJ)
+libc.a: $(OBJ)
ar r ../$(LIBC) $(OBJ)
@touch libc.a
@@ -26,7 +26,7 @@ transfer:
cp -p stdio.h ../include/.
clean:
- rm -f $(OBJ) libc.a
+ rm -f *.o libc.a
$(AOBJ): $(ASRC)
$(CC) $(CFLAGS) -c -DL_$* -o $@ $(ASRC)
diff --git a/libc-0.0.4/stdio2/printf.c b/libc/stdio2/printf.c
index 0d107a4..0d107a4 100644
--- a/libc-0.0.4/stdio2/printf.c
+++ b/libc/stdio2/printf.c
diff --git a/libc-0.0.4/stdio2/scanf.c b/libc/stdio2/scanf.c
index c43320d..c43320d 100644
--- a/libc-0.0.4/stdio2/scanf.c
+++ b/libc/stdio2/scanf.c
diff --git a/libc-0.0.4/stdio2/stdio.c b/libc/stdio2/stdio.c
index 575a8f9..062a982 100644
--- a/libc-0.0.4/stdio2/stdio.c
+++ b/libc/stdio2/stdio.c
@@ -27,8 +27,9 @@ FILE *__IO_list = 0; /* For fflush at exit */
static char bufin[BUFSIZ];
static char bufout[BUFSIZ];
+static char buferr[BUFSIZ];
-#define buferr (stderr->unbuf) /* Stderr is unbuffered */
+/* #define buferr (stderr->unbuf) /* Stderr is unbuffered */
FILE stdin[1] =
{
diff --git a/libc-0.0.4/stdio2/stdio.h b/libc/stdio2/stdio.h
index ba70b1d..ba70b1d 100644
--- a/libc-0.0.4/stdio2/stdio.h
+++ b/libc/stdio2/stdio.h
diff --git a/libc-0.0.4/string/Config b/libc/string/Config
index b712dcf..b712dcf 100644
--- a/libc-0.0.4/string/Config
+++ b/libc/string/Config
diff --git a/libc-0.0.4/string/Makefile b/libc/string/Makefile
index d9c1f46..d72c2e0 100644
--- a/libc-0.0.4/string/Makefile
+++ b/libc/string/Makefile
@@ -15,7 +15,7 @@ OBJ=$(SOBJ) strpbrk.o strsep.o strstr.o strtok.o strcspn.o \
all: $(OBJ)
-$(LIBC): $(OBJ)
+libc.a: $(OBJ)
ar r ../$(LIBC) $(OBJ)
@touch libc.a
@@ -24,7 +24,7 @@ transfer:
cp -p string.h ../include/.
clean:
- rm -f $(OBJ) libc.a
+ rm -f *.o libc.a
$(SOBJ): $(SSRC)
$(CC) $(CFLAGS) -c -DL_$* -o $@ $(SSRC)
diff --git a/libc-0.0.4/string/strcasecmp.c b/libc/string/strcasecmp.c
index 0e7b038..0e7b038 100644
--- a/libc-0.0.4/string/strcasecmp.c
+++ b/libc/string/strcasecmp.c
diff --git a/libc-0.0.4/string/strcspn.c b/libc/string/strcspn.c
index 619c8be..619c8be 100644
--- a/libc-0.0.4/string/strcspn.c
+++ b/libc/string/strcspn.c
diff --git a/libc-0.0.4/string/string.c b/libc/string/string.c
index fad6690..fad6690 100644
--- a/libc-0.0.4/string/string.c
+++ b/libc/string/string.c
diff --git a/libc-0.0.4/include/string.h b/libc/string/string.h
index 8be8eff..2233bf9 100644
--- a/libc-0.0.4/include/string.h
+++ b/libc/string/string.h
@@ -2,6 +2,7 @@
#ifndef __STRING_H
#define __STRING_H
#include <features.h>
+#include <sys/types.h>
#include <stddef.h>
/* Basic string functions */
diff --git a/libc-0.0.4/string/strncasecmp.c b/libc/string/strncasecmp.c
index 561f72a..561f72a 100644
--- a/libc-0.0.4/string/strncasecmp.c
+++ b/libc/string/strncasecmp.c
diff --git a/libc-0.0.4/string/strpbrk.c b/libc/string/strpbrk.c
index 3fc27ec..3fc27ec 100644
--- a/libc-0.0.4/string/strpbrk.c
+++ b/libc/string/strpbrk.c
diff --git a/libc-0.0.4/string/strsep.c b/libc/string/strsep.c
index 21aa1bb..21aa1bb 100644
--- a/libc-0.0.4/string/strsep.c
+++ b/libc/string/strsep.c
diff --git a/libc-0.0.4/string/strspn.c b/libc/string/strspn.c
index 2094caa..2094caa 100644
--- a/libc-0.0.4/string/strspn.c
+++ b/libc/string/strspn.c
diff --git a/libc-0.0.4/string/strstr.c b/libc/string/strstr.c
index aafcaf9..aafcaf9 100644
--- a/libc-0.0.4/string/strstr.c
+++ b/libc/string/strstr.c
diff --git a/libc-0.0.4/string/strtok.c b/libc/string/strtok.c
index 27d8f25..27d8f25 100644
--- a/libc-0.0.4/string/strtok.c
+++ b/libc/string/strtok.c
diff --git a/libc-0.0.4/syscall/Config b/libc/syscall/Config
index 472e74b..472e74b 100644
--- a/libc-0.0.4/syscall/Config
+++ b/libc/syscall/Config
diff --git a/libc-0.0.4/syscall/Makefile b/libc/syscall/Makefile
index 6a2b9bb..2cc4494 100644
--- a/libc-0.0.4/syscall/Makefile
+++ b/libc/syscall/Makefile
@@ -16,22 +16,21 @@ EOBJ=execve.o execl.o execv.o execle.o
DSRC=dirent.c
DOBJ=opendir.o closedir.o readdir.o
+ifeq ($(PLATFORM),i86-DOS)
+OBJ=setjmp.o
+else
OBJ=$(LOBJ) $(DOBJ) $(EOBJ) signal.o setjmp.o execve.o
+endif
all: mksyscall syscall.dat $(OBJ)
sh mksyscall
clean:
- sh mksyscall clean
- rm -f libc.a syscall.c syscall.mak call_tab.v defn_tab.v $(OBJ)
-
-libdos.a: setjmp.o
- ar r ../libc.a setjmp.o
- @touch libc.a
+ rm -f *.o libc.a syscall.c syscall.mak call_tab.v defn_tab.v
libc.a: mksyscall syscall.dat $(OBJ)
sh mksyscall libc.a
- ar r ../libc.a $(OBJ)
+ ar r ../$(LIBC) $(OBJ)
@touch libc.a
$(LOBJ): $(LSRC)
diff --git a/libc-0.0.4/syscall/TODO b/libc/syscall/TODO
index 90085d9..90085d9 100644
--- a/libc-0.0.4/syscall/TODO
+++ b/libc/syscall/TODO
diff --git a/libc-0.0.4/syscall/dirent.c b/libc/syscall/dirent.c
index c484956..bbb3c13 100644
--- a/libc-0.0.4/syscall/dirent.c
+++ b/libc/syscall/dirent.c
@@ -9,7 +9,7 @@
#ifdef L_opendir
DIR *
opendir(dname)
-char *dname;
+const char *dname;
{
struct stat st;
int fd;
diff --git a/libc-0.0.4/syscall/execve.c b/libc/syscall/execve.c
index aee7182..aee7182 100644
--- a/libc-0.0.4/syscall/execve.c
+++ b/libc/syscall/execve.c
diff --git a/libc-0.0.4/syscall/getinfo.c b/libc/syscall/getinfo.c
index a5ab89a..a5ab89a 100644
--- a/libc-0.0.4/syscall/getinfo.c
+++ b/libc/syscall/getinfo.c
diff --git a/libc-0.0.4/syscall/mksyscall b/libc/syscall/mksyscall
index 1d2b27e..1e98836 100644
--- a/libc-0.0.4/syscall/mksyscall
+++ b/libc/syscall/mksyscall
@@ -283,12 +283,9 @@ include $(TOP)/Make.defs
all: $(OBJ)
libc.a: $(OBJ)
- ar r ../libc.a $(OBJ)
+ ar r ../$(LIBC) $(OBJ)
@touch libc.a
-clean:
- rm -f $(OBJ) libc.a
-
$(OBJ): syscall.dat mksyscall
$(CC) $(CFLAGS) -c -DL_$* -o $@ syscall.c
!
diff --git a/libc-0.0.4/syscall/setjmp.c b/libc/syscall/setjmp.c
index 52c3ff1..52c3ff1 100644
--- a/libc-0.0.4/syscall/setjmp.c
+++ b/libc/syscall/setjmp.c
diff --git a/libc-0.0.4/syscall/signal.c b/libc/syscall/signal.c
index dbeac4a..dbeac4a 100644
--- a/libc-0.0.4/syscall/signal.c
+++ b/libc/syscall/signal.c
diff --git a/libc-0.0.4/syscall/syscall.dat b/libc/syscall/syscall.dat
index 397616f..d83be4f 100644
--- a/libc-0.0.4/syscall/syscall.dat
+++ b/libc/syscall/syscall.dat
@@ -68,7 +68,6 @@ RMDIR 40 1
PIPE 42 1
TIMES 43 1
PROF 44 X
-BRK 45 X
SETGID 46 1
GETGID 47 1 * This gets both gid and egid
SIGNAL 48 2 * Have put the despatch table in user space.
@@ -76,11 +75,11 @@ ACCT 51 1
PHYS 52 X
LOCK 53 X
MPX 56 X
-SETPGID 57 X
-ULIMIT 58 X
+SETPGID 57 2
+ULIMIT 58 2
UMASK 60 1
CHROOT 61 1
-USTAT 62 X
+USTAT 62 2
GETPGRP 65 X
SETSID 66 X
SIGACTION 67 X
@@ -90,7 +89,7 @@ SETREUID 70 X
SETREGID 71 X
SIGSUSPEND 72 X
SIGPENDING 73 X
-SETHOSTNAME 74 X
+SETHOSTNAME 74 2
SETRLIMIT 75 X
GETRLIMIT 76 X
REBOOT 76 3 . The magic number is 0xfee1,0xdead,...
@@ -114,8 +113,8 @@ SOCKETCALL 102 X
SYSLOG 103 X
SETITIMER 104 X
GETITIMER 105 X
-UNAME 109 X
-VHANGUP 111 X
+UNAME 109 1
+VHANGUP 111 0
SWAPOFF 115 X
SYSINFO 116 X - Use /proc
IPC 117 5 * This is for all SYSV IPC
@@ -125,7 +124,7 @@ ADJTIMEX 124 X
MPROTECT 125 X
SIGPROCMASK 126 X
QUOTACTL 131 X
-GETPGID 132 X
+GETPGID 132 1
SYSFS 135 X
PERSONALITY 136 X
SETFSUID 138 X
diff --git a/libc-0.0.4/syscall/syslibc.c b/libc/syscall/syslibc.c
index 1e604e8..1e604e8 100644
--- a/libc-0.0.4/syscall/syslibc.c
+++ b/libc/syscall/syslibc.c
diff --git a/libc-0.0.4/termios/Config b/libc/termios/Config
index f0c9bde..f0c9bde 100644
--- a/libc-0.0.4/termios/Config
+++ b/libc/termios/Config
diff --git a/libc-0.0.4/termios/Makefile b/libc/termios/Makefile
index 6925bb3..5c6d3c1 100644
--- a/libc-0.0.4/termios/Makefile
+++ b/libc/termios/Makefile
@@ -7,20 +7,23 @@ include $(TOP)/Make.defs
TSRC=termios.c
TOBJ=tcsetattr.o tcgetattr.o tcdrain.o tcflow.o tcflush.o tcsendbreak.o \
- tcsetpgrp.o tcgetpgrp.o isatty.o
+ tcsetpgrp.o tcgetpgrp.o isatty.o \
+ cfgetospeed.o cfgetispeed.o cfsetospeed.o cfsetispeed.o
-OBJ=$(TOBJ)
+OBJ=$(TOBJ) ttyname.o
all: $(OBJ)
-libdos.a:
-
+ifeq ($(PLATFORM),i86-DOS)
+libc.a:
+else
libc.a: $(OBJ)
- ar r ../libc.a $(OBJ)
+ ar r ../$(LIBC) $(OBJ)
@touch libc.a
+endif
clean:
- rm -f $(OBJ) libc.a
+ rm -f *.o libc.a
$(TOBJ): $(TSRC)
$(CC) $(CFLAGS) -c -DL_$* -o $@ $(TSRC)
diff --git a/libc-0.0.4/termios/README b/libc/termios/README
index c83448d..c83448d 100644
--- a/libc-0.0.4/termios/README
+++ b/libc/termios/README
diff --git a/libc-0.0.4/termios/termios.c b/libc/termios/termios.c
index 1c7da7f..3789c38 100644
--- a/libc-0.0.4/termios/termios.c
+++ b/libc/termios/termios.c
@@ -139,4 +139,47 @@ int fd;
}
#endif
+#ifdef L_cfgetospeed
+int cfgetospeed(tp)
+struct termios *tp;
+{
+ return (tp->c_cflag & CBAUD);
+}
+#endif
+
+#ifdef L_cfgetispeed
+int cfgetispeed(tp)
+struct termios *tp;
+{
+ return (tp->c_cflag & CBAUD);
+}
+#endif
+
+#ifdef L_cfsetospeed
+int cfsetospeed(tp, speed)
+struct termios *tp; speed_t speed;
+{
+#ifdef CBAUDEX
+ if ((speed & ~CBAUD) ||
+ ((speed & CBAUDEX) && (speed < B57600 || speed > B115200)))
+ return 0;
+#else
+ if (speed & ~CBAUD)
+ return 0;
+#endif
+ tp->c_cflag &= ~CBAUD;
+ tp->c_cflag |= speed;
+
+ return 0;
+}
+#endif
+
+#ifdef L_cfsetispeed
+int cfsetispeed(tp, speed)
+struct termios *tp; speed_t speed;
+{
+ return cfsetospeed(tp, speed);
+}
+#endif
+
#endif
diff --git a/libc/termios/ttyname.c b/libc/termios/ttyname.c
new file mode 100644
index 0000000..d777ab3
--- /dev/null
+++ b/libc/termios/ttyname.c
@@ -0,0 +1,45 @@
+
+#include <errno.h>
+#include <sys/stat.h>
+#include <dirent.h>
+
+char *
+ttyname(fd)
+int fd;
+{
+ static char dev[] = "/dev";
+ struct stat st, dst;
+ DIR *fp;
+ struct dirent *d;
+ static char name[MAXNAMLEN];
+ int noerr = errno;
+
+ if (fstat(fd, &st) < 0)
+ return 0;
+ if (!isatty(fd))
+ {
+ errno = ENOTTY;
+ return 0;
+ }
+
+ fp = opendir(dev);
+ if (fp == 0)
+ return 0;
+ strcpy(name, dev);
+ strcat(name, "/");
+
+ while ((d = readdir(fp)) != 0)
+ {
+ strcpy(name + sizeof(dev), d->d_name);
+ if (stat(name, &dst) == 0
+ && st.st_dev == dst.st_dev && st.st_ino == dst.st_ino)
+ {
+ closedir(fp);
+ errno = noerr;
+ return name;
+ }
+ }
+ closedir(fp);
+ errno = noerr;
+ return 0;
+}
diff --git a/libc-0.0.4/tests/Config b/libc/tests/Config
index 4bdf884..4bdf884 100644
--- a/libc-0.0.4/tests/Config
+++ b/libc/tests/Config
diff --git a/libc-0.0.4/tests/makefile b/libc/tests/Makefile
index 150bf45..37e57b8 100644
--- a/libc-0.0.4/tests/makefile
+++ b/libc/tests/Makefile
@@ -8,6 +8,9 @@ CFLAGS=$(CCFLAGS) -ansi
default: all
+libc.a:
+ @echo -n
+
include Real_make
fetch_them:
diff --git a/libc-0.0.4/tests/README b/libc/tests/README
index 642e636..642e636 100644
--- a/libc-0.0.4/tests/README
+++ b/libc/tests/README
diff --git a/libc-0.0.4/tests/Real_make b/libc/tests/Real_make
index 38c4232..38c4232 100644
--- a/libc-0.0.4/tests/Real_make
+++ b/libc/tests/Real_make
diff --git a/libc-0.0.4/tests/compr.c b/libc/tests/compr.c
index 8e53443..8e53443 100644
--- a/libc-0.0.4/tests/compr.c
+++ b/libc/tests/compr.c
diff --git a/libc-0.0.4/tests/env.c b/libc/tests/env.c
index baeb8e9..baeb8e9 100644
--- a/libc-0.0.4/tests/env.c
+++ b/libc/tests/env.c
diff --git a/libc-0.0.4/tests/ft.c b/libc/tests/ft.c
index 6456d0b..6456d0b 100644
--- a/libc-0.0.4/tests/ft.c
+++ b/libc/tests/ft.c
diff --git a/libc-0.0.4/tests/grab.c b/libc/tests/grab.c
index bd62a0f..bd62a0f 100755
--- a/libc-0.0.4/tests/grab.c
+++ b/libc/tests/grab.c
diff --git a/libc-0.0.4/tests/hd.c b/libc/tests/hd.c
index f6af1f9..f6af1f9 100644
--- a/libc-0.0.4/tests/hd.c
+++ b/libc/tests/hd.c
diff --git a/libc-0.0.4/tests/line2.c b/libc/tests/line2.c
index 6cc11ff..6cc11ff 100644
--- a/libc-0.0.4/tests/line2.c
+++ b/libc/tests/line2.c
diff --git a/libc-0.0.4/tests/lines.c b/libc/tests/lines.c
index 6f3afb0..6f3afb0 100644
--- a/libc-0.0.4/tests/lines.c
+++ b/libc/tests/lines.c
diff --git a/libc-0.0.4/tests/ls.c b/libc/tests/ls.c
index 8cae4d0..8cae4d0 100755
--- a/libc-0.0.4/tests/ls.c
+++ b/libc/tests/ls.c
diff --git a/libc-0.0.4/tests/ouch.c b/libc/tests/ouch.c
index c2925c6..c2925c6 100644
--- a/libc-0.0.4/tests/ouch.c
+++ b/libc/tests/ouch.c
diff --git a/libc-0.0.4/tests/rand.c b/libc/tests/rand.c
index c4fc6d2..c4fc6d2 100644
--- a/libc-0.0.4/tests/rand.c
+++ b/libc/tests/rand.c
diff --git a/libc-0.0.4/tests/size.c b/libc/tests/size.c
index 2d6676b..2d6676b 100644
--- a/libc-0.0.4/tests/size.c
+++ b/libc/tests/size.c
diff --git a/libc-0.0.4/tests/sync.c b/libc/tests/sync.c
index 03ca096..03ca096 100644
--- a/libc-0.0.4/tests/sync.c
+++ b/libc/tests/sync.c
diff --git a/libc-0.0.4/tests/ucomp.c b/libc/tests/ucomp.c
index cc3eef8..cc3eef8 100644
--- a/libc-0.0.4/tests/ucomp.c
+++ b/libc/tests/ucomp.c
diff --git a/libc-0.0.4/tests/wc.c b/libc/tests/wc.c
index 08b93ca..08b93ca 100644
--- a/libc-0.0.4/tests/wc.c
+++ b/libc/tests/wc.c
diff --git a/libc/utmp/Makefile b/libc/utmp/Makefile
new file mode 100644
index 0000000..cbb16a8
--- /dev/null
+++ b/libc/utmp/Makefile
@@ -0,0 +1,24 @@
+# Copyright (C) 1996 Nat Friedman <ndf@aleph1.mit.edu>
+# This file is part of the Linux-8086 C library and is distributed
+# under the GNU Library General Public License.
+
+TOP=..
+include $(TOP)/Make.defs
+
+OBJ=utent.o
+
+all: $(OBJ)
+
+libc.a: $(OBJ)
+ ar r ../$(LIBC) $(OBJ)
+ @touch libc.a
+
+%.o:%.c
+ifeq ($(PLATFORM),i386-Linux)
+ $(CC) $(CFLAGS) $< -c -o $@ $(WALL)
+else
+ $(CC) $(CFLAGS) $< -c -o $@ -ansi
+endif
+
+clean:
+ rm -f *.o libc.a
diff --git a/libc/utmp/utent.c b/libc/utmp/utent.c
new file mode 100644
index 0000000..7f9e19a
--- /dev/null
+++ b/libc/utmp/utent.c
@@ -0,0 +1,152 @@
+/* utent.c <ndf@linux.mit.edu> */
+/* Let it be known that this is very possibly the worst standard ever. HP-UX
+ does one thing, someone else does another, linux another... If anyone
+ actually has the standard, please send it to me.
+
+ Note that because of the way this stupid stupid standard works, you
+ have to call endutent() to close the file even if you've not called
+ setutent -- getutid and family use the same file descriptor. */
+
+#include <unistd.h>
+#include <fcntl.h>
+#include <paths.h>
+#include <errno.h>
+#include <string.h>
+#include <utmp.h>
+
+static const char * ut_name=_PATH_UTMP;
+
+static int ut_fd=-1;
+
+struct utmp *
+__getutent(int utmp_fd)
+{
+ static struct utmp utmp;
+ if (read(utmp_fd, (char *) &utmp, sizeof(struct utmp))!=sizeof(struct utmp))
+ return NULL;
+ return &utmp;
+}
+
+void
+setutent(void)
+{
+ if (ut_fd!=-1)
+ close(ut_fd);
+ if ((ut_fd=open(ut_name, O_RDONLY))<0)
+ {
+ perror("setutent: Can't open utmp file");
+ ut_fd=-1;
+ }
+}
+
+void
+endutent(void)
+{
+ if (ut_fd!=-1)
+ close(ut_fd);
+ ut_fd=-1;
+}
+
+struct utmp *
+getutent(void)
+{
+ if (ut_fd==-1)
+ setutent();
+ if (ut_fd==-1)
+ return NULL;
+ return __getutent(ut_fd);
+}
+
+struct utmp *
+getutid(struct utmp * utmp_entry)
+{
+ struct utmp * utmp;
+
+ if (ut_fd==-1)
+ setutent();
+ if (ut_fd==-1)
+ return NULL;
+
+ while ((utmp=__getutent(ut_fd))!=NULL)
+ {
+ if ((utmp_entry->ut_type==RUN_LVL ||
+ utmp_entry->ut_type==BOOT_TIME ||
+ utmp_entry->ut_type==NEW_TIME ||
+ utmp_entry->ut_type==OLD_TIME) &&
+ utmp->ut_type==utmp_entry->ut_type)
+ return utmp;
+ if ((utmp_entry->ut_type==INIT_PROCESS ||
+ utmp_entry->ut_type==DEAD_PROCESS ||
+ utmp_entry->ut_type==LOGIN_PROCESS ||
+ utmp_entry->ut_type==USER_PROCESS) &&
+ !strcmp(utmp->ut_id, utmp_entry->ut_id))
+ return utmp;
+ }
+
+ return NULL;
+}
+
+struct utmp *
+getutline(struct utmp * utmp_entry)
+{
+ struct utmp * utmp;
+
+ if (ut_fd==-1)
+ setutent();
+ if (ut_fd==-1)
+ return NULL;
+
+#if 0 /* This is driving me nuts. It's not an implementation problem -
+ it's a matter of how things _SHOULD_ behave. Groan. */
+ lseek(ut_fd, SEEK_CUR, -sizeof(struct utmp));
+#endif
+
+ while ((utmp=__getutent(ut_fd))!=NULL)
+ {
+ if ((utmp->ut_type==USER_PROCESS ||
+ utmp->ut_type==LOGIN_PROCESS) &&
+ !strcmp(utmp->ut_line, utmp_entry->ut_line))
+ return utmp;
+ }
+
+ return NULL;
+}
+
+struct utmp *
+pututline(struct utmp * utmp_entry)
+{
+ struct utmp * ut;
+
+ /* Ignore the return value. That way, if they've already positioned
+ the file pointer where they want it, everything will work out. */
+ (void) lseek(ut_fd, (off_t) -sizeof(utmp_entry), SEEK_CUR);
+
+ if ((ut=getutid(utmp_entry))!=NULL)
+ {
+ lseek(ut_fd, (off_t) -sizeof(utmp_entry), SEEK_CUR);
+ if (write(ut_fd, (char *) utmp_entry, sizeof(utmp_entry))
+ != sizeof(utmp_entry))
+ return NULL;
+ }
+ else
+ {
+ lseek(ut_fd, (off_t) 0, SEEK_END);
+ if (write(ut_fd, (char *) utmp_entry, sizeof(utmp_entry))
+ != sizeof(utmp_entry))
+ return NULL;
+ }
+
+ return utmp_entry;
+}
+
+void
+utmpname(const char * new_ut_name)
+{
+ if (new_ut_name!=NULL)
+ ut_name=new_ut_name;
+
+ if (ut_fd!=-1)
+ close(ut_fd);
+}
+
+