Initial Import from SVN

This commit is contained in:
Matt Jenkins
2014-04-09 14:27:18 +01:00
parent 8976e834c4
commit 895f96d2f7
3153 changed files with 748589 additions and 0 deletions

193
Makefile Normal file
View File

@@ -0,0 +1,193 @@
# Copyright (c) 1986 Regents of the University of California.
# All rights reserved. The Berkeley software License Agreement
# specifies the terms and conditions for redistribution.
#
# This makefile is designed to be run as:
# make
#
# The `make' will compile everything, including a kernel, utilities
# and a root filesystem image.
#
# Supported boards
#
MAX32 = sys/pic32/max32/MAX32
UBW32 = sys/pic32/ubw32/UBW32
UBW32UART = sys/pic32/ubw32-uart/UBW32-UART
UBW32UARTSDRAM = sys/pic32/ubw32-uart-sdram/UBW32-UART-SDRAM
MAXIMITE = sys/pic32/maximite/MAXIMITE
MAXCOLOR = sys/pic32/maximite-color/MAXCOLOR
EXPLORER16 = sys/pic32/explorer16/EXPLORER16
STARTERKIT = sys/pic32/starter-kit/STARTER-KIT
DUINOMITE = sys/pic32/duinomite/DUINOMITE
DUINOMITEUART = sys/pic32/duinomite-uart/DUINOMITE-UART
DUINOMITEE = sys/pic32/duinomite-e/DUINOMITE-E
DUINOMITEEUART = sys/pic32/duinomite-e-uart/DUINOMITE-E-UART
PINGUINO = sys/pic32/pinguino-micro/PINGUINO-MICRO
DIP = sys/pic32/dip/DIP
BAREMETAL = sys/pic32/baremetal/BAREMETAL
RETROONE = sys/pic32/retroone/RETROONE
FUBARINO = sys/pic32/fubarino/FUBARINO
FUBARINOUART = sys/pic32/fubarino-uart/FUBARINO-UART
MMBMX7 = sys/pic32/mmb-mx7/MMB-MX7
# Select target board
TARGET ?= $(MAX32)
# Filesystem and swap sizes.
FS_KBYTES = 102400
U_KBYTES = 102400
SWAP_KBYTES = 2048
# Set this to the device name for your SD card. With this
# enabled you can use "make installfs" to copy the filesys.img
# to the SD card.
#SDCARD = /dev/sdb
#
# C library options: passed to libc makefile.
# See lib/libc/Makefile for explanation.
#
DEFS =
FSUTIL = tools/fsutil/fsutil
-include Makefile.user
TARGETDIR = $(shell dirname $(TARGET))
TARGETNAME = $(shell basename $(TARGET))
TOPSRC = $(shell pwd)
CONFIG = $(TOPSRC)/tools/configsys/config
#
# Filesystem contents.
#
BIN_FILES := $(wildcard bin/*)
SBIN_FILES := $(wildcard sbin/*)
GAMES_FILES := $(shell find games -type f ! -path '*/.*')
LIBEXEC_FILES := $(wildcard libexec/*)
LIB_FILES := lib/crt0.o lib/retroImage $(wildcard lib/*.a)
ETC_FILES = etc/rc etc/rc.local etc/ttys etc/gettytab etc/group \
etc/passwd etc/shadow etc/fstab etc/motd etc/shells \
etc/termcap etc/MAKEDEV etc/phones etc/remote
INC_FILES = $(wildcard include/*.h) \
$(wildcard include/sys/*.h) \
$(wildcard include/machine/*.h) \
$(wildcard include/smallc/*.h) \
$(wildcard include/smallc/sys/*.h) \
$(wildcard include/arpa/*.h)
SHARE_FILES = share/re.help share/example/Makefile \
share/example/ashello.S share/example/chello.c \
share/example/blkjack.bas share/example/hilow.bas \
share/example/stars.bas share/example/prime.scm \
share/example/fact.fth share/example/echo.S \
$(wildcard share/smallc/*)
MANFILES = share/man/ share/man/cat1/ share/man/cat2/ share/man/cat3/ \
share/man/cat4/ share/man/cat5/ share/man/cat6/ share/man/cat7/ \
share/man/cat8/ $(wildcard share/man/cat?/*)
ALLFILES = $(SBIN_FILES) $(ETC_FILES) $(BIN_FILES) $(LIB_FILES) $(LIBEXEC_FILES) \
$(INC_FILES) $(SHARE_FILES) $(GAMES_FILES) \
var/log/messages var/log/wtmp .profile
ALLDIRS = games/ sbin/ bin/ dev/ etc/ tmp/ lib/ libexec/ share/ include/ \
var/ u/ share/example/ share/misc/ share/smallc/ \
var/run/ var/log/ var/lock/ games/ games/lib/ include/sys/ \
include/machine/ include/arpa/ include/smallc/ \
include/smallc/sys/ share/misc/ share/smallc/ include/sys/ \
games/lib/
BDEVS = dev/rd0!b0:0 dev/rd0a!b0:1 dev/rd0b!b0:2 dev/rd0c!b0:3 dev/rd0d!b0:4
BDEVS += dev/rd1!b1:0 dev/rd1a!b1:1 dev/rd1b!b1:2 dev/rd1c!b1:3 dev/rd1d!b1:4
BDEVS += dev/rd2!b2:0 dev/rd2a!b2:1 dev/rd2b!b2:2 dev/rd2c!b2:3 dev/rd2d!b2:4
BDEVS += dev/rd3!b3:0 dev/rd3a!b3:1 dev/rd3b!b3:2 dev/rd3c!b3:3 dev/rd3d!b3:4
BDEVS += dev/swap!b4:64 dev/swap0!b4:0 dev/swap1!b4:1 dev/swap2!b4:2
D_CONSOLE = dev/console!c0:0
D_MEM = dev/mem!c1:0 dev/kmem!c1:1 dev/null!c1:2 dev/zero!c1:3
D_TTY = dev/tty!c2:0
D_FD = dev/stdin!c3:0 dev/stdout!c3:1 dev/stderr!c3:2
D_TEMP = dev/temp0!c4:0 dev/temp1!c4:1 dev/temp2!c4:2
U_DIRS = $(addsuffix /,$(shell find u -type d ! -path '*/.svn*'))
U_FILES = $(shell find u -type f ! -path '*/.svn/*')
#U_ALL = $(patsubst u/%,%,$(U_DIRS) $(U_FILES))
CDEVS = $(D_CONSOLE) $(D_MEM) $(D_TTY) $(D_FD) $(D_TEMP)
all: tools build kernel
$(MAKE) fs
fs: sdcard.rd
.PHONY: tools
tools:
$(MAKE) -C tools
kernel: $(TARGETDIR)/Makefile
$(MAKE) -C $(TARGETDIR)
$(TARGETDIR)/Makefile: $(CONFIG) $(TARGETDIR)/$(TARGETNAME)
cd $(TARGETDIR) && ../../../tools/configsys/config $(TARGETNAME)
.PHONY: lib
lib:
$(MAKE) -C lib
build: tools lib
$(MAKE) -C src install
filesys.img: $(FSUTIL) $(ALLFILES)
rm -f $@
$(FSUTIL) -n$(FS_KBYTES) $@
$(FSUTIL) -a $@ $(ALLDIRS)
$(FSUTIL) -a $@ $(CDEVS)
$(FSUTIL) -a $@ $(BDEVS)
$(FSUTIL) -a $@ $(ALLFILES)
$(FSUTIL) -a $@ $(MANFILES)
swap.img:
dd if=/dev/zero of=$@ bs=1k count=$(SWAP_KBYTES)
user.img: $(FSUTIL)
ifneq ($(U_KBYTES), 0)
rm -f $@
$(FSUTIL) -n$(U_KBYTES) $@
(cd u; find . -type d -exec ../$(FSUTIL) -a ../$@ '{}/' \;)
(cd u; find . -type f -exec ../$(FSUTIL) -a ../$@ '{}' \+)
endif
sdcard.rd: filesys.img swap.img user.img
ifneq ($(U_KBYTES), 0)
tools/mkrd/mkrd -out $@ -boot filesys.img -swap swap.img -fs user.img
else
tools/mkrd/mkrd -out $@ -boot filesys.img -swap swap.img
endif
$(FSUTIL):
cd tools/fsutil; $(MAKE)
$(CONFIG):
make -C tools/configsys
clean:
rm -f *~
for dir in tools lib src sys/pic32; do $(MAKE) -C $$dir -k clean; done
cleanall: clean
$(MAKE) -C lib clean
rm -f sys/pic32/*/unix.hex bin/* sbin/* games/[a-k]* games/[m-z]* libexec/* share/man/cat*/*
rm -f games/lib/adventure.dat
rm -f games/lib/cfscores
rm -f share/re.help
rm -f share/misc/more.help
rm -f etc/termcap etc/remote etc/phones
rm -rf share/unixbench
rm -f games/lib/adventure.dat games/lib/cfscores share/re.help share/misc/more.help etc/termcap
rm -f tools/configsys/.depend
rm -f var/log/aculog
rm -rf var/lock
installfs: filesys.img
ifdef SDCARD
sudo dd bs=32k if=sdcard.rd of=$(SDCARD)
else
@echo "Error: No SDCARD defined."
endif

130
README Normal file
View File

@@ -0,0 +1,130 @@
This is the RetroBSD source directory.
Source Roadmap
~~~~~~~~~~~~~~
bin User commands.
etc Template files for /etc.
include System include files.
lib System libraries.
libexec System binaries.
sbin System administration commands.
share Shared resources.
sys Kernel sources.
tools Build tools and simulators.
Supported hardware
~~~~~~~~~~~~~~~~~~
* chipKIT Max32 board.
* Sparkfun UBW32 board.
* Maximite and Colour Maximite computers.
* Microchip Explorer 16 board, with PIC32 CAN-USB plug-in module and SD & MMC pictail.
* Microchip PIC32 USB or Ethernet Starter Kit, with I/O Expansion board and SD & MMC pictail.
* Olimex Duinomite, Duinomite-Mini and Duinomite-Mega boards.
* Olimex Pinguino-Micro board with PIC32MX795F512H microcontroller.
* eflightworks DIP board.
Build
~~~~~
By default, the system is configured for the Max32 board.
To select another target board, edit a top-level Makefile
and change a TARGET value under section "Select target board":
TARGET = $(UBW32) # for the UBW32 board with USB console
TARGET = $(UBW32UART) # for the UBW32 board with UART console
TARGET = $(MAXIMITE) # for the Maximite board
TARGET = $(MAXCOLOR) # for the Colour Maximite board
TARGET = $(EXPLORER16) # for the Explorer 16 board
TARGET = $(STARTERKIT) # for the PIC32 USB or Ethernet Starter Kit
TARGET = $(MAX32) # default
TARGET = $(DUINOMITE) # for the Duinomite board
TARGET = $(PINGUINO) # for the Pinguino-Micro board
TARGET = $(DIP) # for the DIP board
You can also change a desired filesystem size and swap area size,
as required. Default is:
FS_KBYTES = 16384
SWAP_KBYTES = 2048
To compile the kernel and build a filesystem image, run:
make
A resulting root filesystem image is in file `filesys.img`.
A kernel is in file `unix.hex` in your target board subdirectory.
Filesystem image
~~~~~~~~~~~~~~~~
You need to put a filesystem image on a SD card. On Windows, use
Win32DiskImager utility (https://launchpad.net/win32-image-writer/+download).
On Linux, run:
sudo dd if=filesys.img of=/dev/XYZ
Here `XYZ` is a device name of SD card, as recognized by Linux (sdb in my case).
Install kernel
~~~~~~~~~~~~~~
Kernel image should be written to PIC32 flash memory. The procedure depends
on a board used.
Max32 board:
cd sys/pic32/ubw32
AVRTOOLS=/Applications/Mpide.app/Contents/Resources/Java/hardware/tools
$AVRTOOLS/bin/avrdude -C$AVRTOOLS/etc/avrdude.conf -c stk500v2 -p pic32 \
-P /dev/tty.usbserial-* -b 115200 -v -U flash:w:unix.hex:i
Here you need to change AVRTOOLS path and tty name according to your system.
UBW32 board:
Use a pic32prog utility (http://code.google.com/p/pic32prog/)
and a USB cable to install a kernel:
pic32prog sys/pic32/ubw32/unix.hex
Maximite:
Use the bootload program for Windows, available for download by link:
http://geoffg.net/Downloads/Maximite/Maximite_Update_V2.7B.zip
Explorer 16 board:
There is an auxiliary PIC18 chip on the Explorer 16 board, which can be
used as a built-in programmer device. You will need a PICkit 2 adapter
to install a needed firmware, as described in article:
http://www.paintyourdragon.com/?p=51
(section "Hack #2: Lose the PICkit 2, Save $35").
This should be done only once.
Then, you can use a pic32prog utility (http://code.google.com/p/pic32prog/)
and a USB cable to install a kernel:
pic32prog sys/pic32/explorer16/unix.hex
PIC32 Starter Kit:
Use PICkit 2 adapter and software to install a boot loader from
file `sys/pic32/starter-kit/boot.hex`. This should be done only once.
Then, you can use a pic32prog utility (http://code.google.com/p/pic32prog/)
and a USB cable to install a kernel:
pic32prog sys/pic32/starter-kit/unix.hex
Simulator
~~~~~~~~~
You can use a MIPS32 simulator to develop a debug a RetroBSD software,
without a need for hardware board. By default, a simulator is configured
to imitate a Max32 board. To build it:
cd tools/virtualmips
make
Run it:
./pic32
Configuration of simulated board is stored in file `pic32_max32.conf`.

31
cross.mk Normal file
View File

@@ -0,0 +1,31 @@
DESTDIR = /usr/local/retrobsd
MACHINE = mips
CC = gcc
AS = $(CC) -x assembler-with-cpp
LD = ld
AR = ar
RANLIB = ranlib
YACC = byacc
LEX = flex
SIZE = size
#OBJDUMP = objdump
OBJDUMP = sync --
INSTALL = install -m 644
INSTALLDIR = install -m 755 -d
TAGSFILE = tags
MANROFF = nroff -man -h
ELF2AOUT = cp
CFLAGS = -O -DCROSS
LDFLAGS =
LIBS =
# Add system include path
ifeq (,$(wildcard /usr/include/i386-linux-gnu))
CFLAGS += -I/usr/include
else
CFLAGS += -I/usr/include/i386-linux-gnu
endif
CFLAGS += -I$(TOPSRC)/include

175
etc/MAKEDEV Executable file
View File

@@ -0,0 +1,175 @@
#!/bin/sh -
#
# Copyright (c) 1980 Regents of the University of California.
# All rights reserved. The Berkeley software License Agreement
# specifies the terms and conditions for redistribution.
#
# @(#)MAKEDEV 4.27.6 (2.11BSD) 1999/2/19
#
# Device "make" file. Valid arguments:
# std standard devices
# local configuration specific devices
# fd file descriptor driver
# Tapes:
# ht* unibus tu77 & te16
# tm* unibus tm11 & te10 emulations (e.g. Emulex tc-11)
# ts* unibus ts11
# tu* tmscp (tk50/tu81)
# Disks:
# br* unibus Eaton br1538 or br1711
# hk* unibus rk06 and rk07
# ra* unibus uda50 w/ ra??
# rk* unibus rk05
# rl* unibus rl01/rl02
# rx* unibus rx02
# si* unibus cdc 9766 w/ si 9500
# xp* unibus rm02/03/05, rp04/05/06, diva, eagle, cdc9766, fuji 160.
# Terminal multiplexors:
# dl* dl-11 units other than the console
# dz* unibus dz11 and dz32
# dh* unibus dh11 and emulations (e.g. Able dmax, Emulex cs-11)
# dmf* unibus dmf32
# dhu* unibus dhu11
# dmz* unibus dmz32
# dhv* qbus dhv11
# Pseudo terminals:
# pty* set of 16 master and slave pseudo terminals
# Printers:
# lp* unibus lp11 parallel interface
# va* unibus varian parallel interface
# vp* unibus versatec parallel interface
# Call units:
# Special purpose devices:
# dr* unibus dr11
# ram* memory disk
# dn* dn11 dialer
# ingreslock Ingres lock driver.
PATH=/etc:/sbin:/usr/sbin:/bin:/usr/bin
umask 77
for i
do
case $i in
std)
mknod console c 0 0
mknod mem c 1 0 ; chmod 640 mem ; chgrp kmem mem
mknod kmem c 1 1 ; chmod 640 kmem ; chgrp kmem kmem
mknod null c 1 2 ; chmod 666 null
mknod zero c 1 3 ; chmod 444 zero
mknod tty c 2 0 ; chmod 666 tty
mknod klog c 3 0 ; chmod 600 klog
;;
fd)
umask 0
rm -rf fd
rm -f stdin stdout stderr
mkdir fd
chmod 755 fd
mknod stdin c 4 0
mknod stdout c 4 1
mknod stderr c 4 2
eval `echo "" | awk '{ for (i = 0; i < 32; i++)
printf("mknod fd/%d c 4 %d; ",i,i); }'`
;;
rd)
umask 2
rm -f rd[0123] rd[0123][abcd]
mknod rd0 b 0 0
mknod rd0a b 0 1
mknod rd0b b 0 2
mknod rd0c b 0 2
mknod rd0d b 0 2
mknod rd1 b 1 0
mknod rd1a b 1 1
mknod rd1b b 1 2
mknod rd1c b 1 2
mknod rd1d b 1 2
mknod rd2 b 2 0
mknod rd2a b 2 1
mknod rd2b b 2 2
mknod rd2c b 2 2
mknod rd2d b 2 2
mknod rd3 b 3 0
mknod rd3a b 3 1
mknod rd3b b 3 2
mknod rd3c b 3 2
mknod rd3d b 3 2
chgrp operator rd[0123]
chgrp operator rd[0123][abcd]
chmod 640 rd[0123][abcd]
chmod 640 rd[0123]
;;
gpio)
umask 0
rm -f port[abcdefg] conf[abcdef]
mknod porta c 5 0
mknod portb c 5 1
mknod portc c 5 2
mknod portd c 5 3
mknod porte c 5 4
mknod portf c 5 5
mknod portg c 5 6
mknod confa c 5 64
mknod confb c 5 65
mknod confc c 5 66
mknod confd c 5 67
mknod confe c 5 68
mknod conff c 5 69
mknod confg c 5 70
;;
adc)
umask 0
rm -f adc[0123456789] adc1[012345]
mknod adc0 c 6 0
mknod adc1 c 6 1
mknod adc2 c 6 2
mknod adc3 c 6 3
mknod adc4 c 6 4
mknod adc5 c 6 5
mknod adc6 c 6 6
mknod adc7 c 6 7
mknod adc8 c 6 8
mknod adc9 c 6 9
mknod adc10 c 6 10
mknod adc11 c 6 11
mknod adc12 c 6 12
mknod adc13 c 6 13
mknod adc14 c 6 14
mknod adc15 c 6 15
;;
spi)
umask 0
rm -f spi[1234]
mknod spi1 c 7 0
mknod spi2 c 7 1
mknod spi3 c 7 2
mknod spi4 c 7 3
;;
glcd)
umask 0
rm -f glcd0
mknod glcd0 c 8 0
;;
oc)
umask 0
rm -f oc[12345]
mknod oc1 c 9 0
mknod oc2 c 9 1
mknod oc3 c 9 2
mknod oc4 c 9 3
mknod oc5 c 9 4
;;
local)
sh MAKEDEV.local
;;
esac
done

26
etc/MAKEDEV.local Executable file
View File

@@ -0,0 +1,26 @@
rm -f swap
ln ra0a swap
chgrp kmem swap
chmod 640 swap
rm -f ttyi6 ttyd0; mknod ttyd0 c 3 22
rm -f ttyi7 ttyd1; mknod ttyd1 c 3 23
rm -f ttyi8 ttyd2; mknod ttyd2 c 3 24
rm -f ttyi9 ttyd3; mknod ttyd3 c 3 25
rm -f ttyia ttyd4; mknod ttyd4 c 3 26
rm -f ttyic ttyd5; mknod ttyd5 c 3 156
rm -f ttyh1 dir-shasta; mknod dir-shasta c 3 1
rm -f ttyh6 dir-rose; mknod dir-rose c 3 6
rm -f ttyh7 dir-namsan; mknod dir-namsan c 3 7
rm -f ttyid dir-ps; mknod dir-ps c 3 157
rm -f ttyie cua0; mknod cua0 c 3 158
rm -f ttyif dir-scgl; mknod dir-scgl c 3 159
chown uucp dir-*
chmod 660 dir-*
# Cua* can't be owned by anyone real who wants to use the dialer if the mode
# 060 below and the dialer group is to work. Note that the uucp programs
# must be in the dialer group.
chown 32767 cua*
chgrp dialer cua*
chmod 060 cua*

79
etc/Makefile Normal file
View File

@@ -0,0 +1,79 @@
#
# DESTDIR is defined here to be something which does *NOT* exist - it must be
# specified on the command line when doing a "make DESTDIR=/mnt distribution".
# This is aimed at avoiding overwriting the system disk's /etc files.
#
# Example:
# mount /dev/ra1a /mnt
# make DESTDIR=/mnt distribution
DESTDIR = /foobar
OWN = root
GRP = wheel
SUBDIR = root
FILES = crontab fstab gettytab group motd passwd \
rc rc.local shells syslog.conf ttys
all install depend lint tags:
clean:
rm -f *~
-for i in ${SUBDIR}; do \
(cd $$i; make DESTDIR=${DESTDIR} $@); done
distribution:
-@mkdir -p ${DESTDIR}/dev
@chmod 755 ${DESTDIR}/dev
-@mkdir -p ${DESTDIR}/etc
@chmod 755 ${DESTDIR}/etc
@chown ${OWN}.${GRP} ${DESTDIR}/dev ${DESTDIR}/etc
-@mkdir -p ${DESTDIR}/usr/spool/mqueue
@chmod 755 ${DESTDIR}/usr/spool/mqueue
@chown ${OWN}.${GRP} ${DESTDIR}/usr/spool/mqueue
install -c -o ${OWN} -g ${GRP} -m 644 ${FILES} ${DESTDIR}/etc
install -c -o root -g wheel -m 600 master.passwd ${DESTDIR}/etc
install -c -o ${OWN} -g ${GRP} -m 600 hosts.equiv ${DESTDIR}/etc
install -c -o ${OWN} -g ${GRP} -m 555 MAKEDEV.local MAKEDEV \
${DESTDIR}/dev
install -c -o ${OWN} -g operator -m 664 /dev/null \
${DESTDIR}/etc/dumpdates
install -c -o ${OWN} -g operator -m 664 /dev/null \
${DESTDIR}/etc/sendmail.cw
install -c -o ${OWN} -g operator -m 664 /dev/null \
${DESTDIR}/etc/sendmail.fc
-@mkdir -p ${DESTDIR}/usr/adm ${DESTDIR}/var/run ${DESTDIR}/var/db
@chmod 655 ${DESTDIR}/usr/adm ${DESTDIR}/var/run ${DESTDIR}/var/db
@chown ${OWN}.${GRP} ${DESTDIR}/usr/adm ${DESTDIR}/var/run \
${DESTDIR}/var/db
install -c -o ${OWN} -g ${GRP} -m 644 /dev/null \
${DESTDIR}/usr/adm/messages
install -c -o ${OWN} -g ${GRP} -m 644 /dev/null \
${DESTDIR}/usr/adm/daemonlog
install -c -o ${OWN} -g ${GRP} -m 644 /dev/null \
${DESTDIR}/usr/adm/debuglog
install -c -o ${OWN} -g operator -m 664 /dev/null \
${DESTDIR}/usr/adm/shutdownlog
install -c -o ${OWN} -g ${GRP} -m 644 /dev/null \
${DESTDIR}/usr/spool/mqueue/syslog
install -c -o ${OWN} -g ${GRP} -m 644 /dev/null \
${DESTDIR}/usr/adm/lpd-errs
install -c -o ${OWN} -g ${GRP} -m 644 /dev/null \
${DESTDIR}/var/run/utmp
install -c -o nobody -g ${GRP} -m 644 /dev/null \
${DESTDIR}/var/db/find.codes
install -c -o ${OWN} -g ${GRP} -m 644 /dev/null \
${DESTDIR}/usr/adm/lastlog
install -c -o ${OWN} -g ${GRP} -m 644 /dev/null \
${DESTDIR}/usr/adm/wtmp
install -c -o ${OWN} -g ${GRP} -m 644 /dev/null \
${DESTDIR}/usr/adm/acct
install -c -o ${OWN} -g ${GRP} -m 644 /dev/null \
${DESTDIR}/usr/adm/usracct
install -c -o ${OWN} -g ${GRP} -m 644 /dev/null \
${DESTDIR}/usr/adm/savacct
install -c -o uucp -g daemon -m 600 /dev/null \
${DESTDIR}/usr/adm/aculog
-for i in ${SUBDIR}; do \
(cd $$i; make DESTDIR=${DESTDIR} distribution); done

2
etc/fstab Normal file
View File

@@ -0,0 +1,2 @@
/dev/rd0a / ufs rw,async 1 1
#/dev/rd0c /u ufs rw,async 1 2

164
etc/gettytab Normal file
View File

@@ -0,0 +1,164 @@
# Copyright (c) 1980 Regents of the University of California.
# All rights reserved. The Berkeley software License Agreement
# specifies the terms and conditions for redistribution.
#
# @(#)gettytab 5.7.2 (2.11BSD GTE) 1997/3/28
#
#
# Most of the table entries here are just copies of the
# old getty table, it is by no means certain, or even likely,
# then any of them are optimal for any purpose whatever.
# Nor is it likely that more than a couple are even correct
#
#
# The default gettytab entry, used to set defaults for all other
# entries, and in cases where getty is called with no table name
#
default:\
:ap:im=\r\n\r\n2.11 BSD UNIX (%h) (%t)\r\n\r\r\n\r:sp#1200:
#
# Fixed speed entries
#
# The "std.NNN" names are known to the special case
# portselector code in getty, however they can
# be assigned to any table desired.
# The "NNN-baud" names are known to the special case
# autobaud code in getty, and likewise can
# be assigned to any table desired (hopefully the same speed).
#
a|std.50|50-baud:\
:sp#50:
b|std.75|75-baud:\
:ep:sp#75:ht:nl:
1|std.150|150-baud:\
:ep:sp#150:ht:nl:lm=\E\72\6\6\17login\72 :
c|std.300|300-baud:\
:sp#300:
d|std.600|600-baud:\
:sp#600:
f|std.1200|1200-baud:\
:sp#1200:
6|std.2400|2400-baud:\
:sp#2400:ht:
7|std.4800|4800-baud:\
:sp#4800:ht:
2|std.9600|9600-baud:\
:sp#9600:
g|std.19200|19200-baud:\
:sp#19200:
h|std.38400|38400-baud:\
:sp#38400:
i|std.57600|57600-baud:\
:sp#57600:
j|std.115200|115200-baud:\
:sp#115200:
k|std.230400|230400-baud:\
:sp#230400:
l|std.460800|460800-baud:\
:sp#460800:
m|std.500000|500000-baud:\
:sp#500000:
n|std.576000|576000-baud:\
:sp#576000:
o|std.921600|921600-baud:\
:sp#921600:
p|std.1000000|1000000-baud:\
:sp#1000000:
q|std.1152000|1152000-baud:\
:sp#1152000:
r|std.1500000|1500000-baud:\
:sp#1500000:
s|std.2000000|2000000-baud:\
:sp#2000000:
t|std.2500000|2500000-baud:\
:sp#2500000:
u|std.3000000|3000000-baud:\
:sp#3000000:
v|std.3500000|3500000-baud:\
:sp#3500000:
w|std.4000000|4000000-baud:\
:sp#4000000:
x|std.default|default-baud:\
:sp#0:
#
# Hardware flow control lines
#
t9600-hf:hf:sp#9600
t19200-hf:hf:sp#19200
t38400-hf:hf:sp#38400
#
# Dial in rotary tables, speed selection via 'break'
#
0|d300|Dial-300:\
:nx=d1200:sp#300:
d1200|Dial-1200:\
:nx=d150:sp#1200:
d150|Dial-150:\
:nx=d110:lm@:tc=150-baud:
d110|Dial-110:\
:nx=d300:tc=300-baud:
#
# Odd special case terminals
#
-|tty33|asr33|Pity the poor user of this beast:\
:tc=110-baud:
4|Console|Console Decwriter II:\
:rw:tc=300-baud:
e|Console-1200|Console Decwriter III:\
:rw:tc=1200-baud:
l|lsi chess terminal:\
:sp#300:
X|Xwindow|X window system:\
:rw:sp#9600:
#
# Fast dialup terminals, 2400/1200/300 rotary (can start either way)
#
D2400|Fast-Dial-2400:\
:nx=D1200:tc=2400-baud:
3|D1200|Fast-Dial-1200:\
:nx=D300:tc=1200-baud:
5|D300|Fast-Dial-300:\
:nx=D2400:tc=300-baud:
#
# Wierdo special case for fast crt's with hardcopy devices
#
8|T9600|CRT with hardcopy:\
:nx=T300:tc=9600-baud:
9|T300|CRT with hardcopy (300):\
:nx=T9600:tc=300-baud:
#
# Plugboard, and misc other terminals
#
p|P9600|Plugboard-9600:\
:nx=P300:tc=9600-baud:
q|P300|Plugboard-300:\
:nx=P1200:tc=300-baud:
r|P1200|Plugboard-1200:\
:nx=P9600:tc=1200-baud:
#
# XXXX Port selector
#
s|DSW|Port Selector:\
:ps:sp#2400:
#
# Auto-baud speed detect entry for Micom 600.
# Special code in getty will switch this out
# to one of the NNN-baud entries.
#
A|Auto-baud:\
:ab:sp#2400:f0#040:

10
etc/group Normal file
View File

@@ -0,0 +1,10 @@
wheel:*:0:root
daemon:*:1:daemon
kmem:*:2:
sys:*:3:
tty:*:4:
operator:*:5:
staff:*:10:
bin:*:20:
guest:*:31:
ingres:*:74:

1
etc/motd Normal file
View File

@@ -0,0 +1 @@
Welcome to RetroBSD!

8
etc/passwd Normal file
View File

@@ -0,0 +1,8 @@
root:5:0:1:The Man:/:/bin/sh
daemon:*:1:1:The devil himself:/:/bin/sh
sys:*:4:2:Operating System:/tmp:nologin
operator:*:2:5:System &:/usr/guest/operator:/bin/csh
bin:*:3:20:Binaries Commands and Source:/:/bin/csh
nobody:*:32767:31:Nobody:/nonexistent:/bin/sh
uucp:*:66:1:UNIX-to-UNIX Copy:/usr/spool/uucppublic:/usr/sbin/uucico
ingres:*:39:74:INGRES Owner:/usr/ingres:/bin/csh

73
etc/rc Executable file
View File

@@ -0,0 +1,73 @@
#!/bin/sh
HOME=/; export HOME
PATH=/bin:/sbin; export PATH
exec >/dev/console 2>&1
/sbin/devupdate
if test "$1" != "autoboot"; then
#
# Switch from single-user to multi-user mode.
#
echo
# Halt the processor.
#reboot -l -h
exit 0
fi
#
# Entering multiuser mode: check filesystems
#
# This will *only* work if fsck can do your root file system
# without a temporary file, and if the root file system is
# checked alone in a pass by itself -- be careful! This can
# *seriously* mess you up.
#
fsck -p
case $? in
0)
# Filesystems are clean
;;
2)
echo "--- Critical errors detected: run fsck to repair manually"
exit 1 ;;
4)
# Root filesystem modified: NO SYNC!
echo "--- Errors repaired, rebooting..."
reboot -n ;;
8)
echo "--- Filesystem check failed... help!"
exit 1 ;;
12)
echo "--- Interrupted by user"
exit 1 ;;
*)
echo "--- Unknown error in fsck"
exit 1 ;;
esac
hostname "pic32"
#
# First umount everything in case the system is going back into multiuser
# mode. If the system is being booted for the first time nothing is mounted
# except the root filesystem and umount ignores attempts to unmount /.
#
umount -a
#
# Now mount everything mentioned in /etc/fstab *except* filesystems with the
# 'na' (noauto) option.
#
mount -a
rm -f /etc/nologin
echo -n "Starting daemons:"
update && echo -n "update"
cron && echo -n "cron"
echo
#/etc/rc.local
exit 0

2
etc/rc.local Executable file
View File

@@ -0,0 +1,2 @@
#! /bin/sh -
# site-specific startup actions, daemons

18
etc/root/Makefile Normal file
View File

@@ -0,0 +1,18 @@
#
# DESTDIR is defined here to be something which does *NOT* exist - it must be
# specified on the command line when doing a "make DESTDIR=/mnt distribution".
# This is aimed at avoiding overwriting the system disk's /etc files.
DESTDIR = /foobar
OWN = root
GRP = wheel
all install depend lint tags:
distribution:
install -c -o ${OWN} -g ${GRP} -m 644 dot.cshrc ${DESTDIR}/.cshrc
install -c -o ${OWN} -g ${GRP} -m 644 dot.login ${DESTDIR}/.login
install -c -o ${OWN} -g ${GRP} -m 644 dot.profile ${DESTDIR}/.profile
clean:
rm -f *~

14
etc/root/dot.cshrc Normal file
View File

@@ -0,0 +1,14 @@
set history=30
set path=(/bin /sbin /etc /usr/sbin /usr/ucb /usr/bin /usr/new /usr/local)
if ($?prompt) then
set prompt="\!% "
endif
set filec
set mail=( 0 /usr/spool/mail/$USER )
set cdpath=( ~ /usr/spool/mqueue)
set prompt="\!% root--> "
alias mail /usr/ucb/Mail
alias pwd 'echo $cwd'
alias h history
alias q5 'tail -5 /usr/spool/mqueue/syslog'

14
etc/root/dot.login Normal file
View File

@@ -0,0 +1,14 @@
unset noglob
set path=(/bin /etc /sbin /usr/sbin /usr/ucb /usr/bin /usr/local /usr/new)
umask 26
stty dec erase ^H kill ^U eof ^D
set prompt="[\!] root--> "
if ( "$TERM" == dialup || "$TERM" == network) then
setenv TERM vt100
echo -n "Terminal ($TERM)? "
set argv = "$<"
if ( "$argv" != '' ) setenv TERM "$argv"
endif
biff y

8
etc/root/dot.profile Normal file
View File

@@ -0,0 +1,8 @@
echo 'erase, kill ^U, intr ^C'
stty dec
stty erase
PATH=/bin:/sbin:/usr/sbin:/etc:/usr/ucb:/usr/bin:/usr/new
export PATH
HOME=/
export HOME
export TERM

8
etc/shadow Normal file
View File

@@ -0,0 +1,8 @@
root:ro46DZg1ViGBs:0:1:The Man:/:/bin/sh
daemon:*:1:1:The devil himself:/:/bin/sh
sys:*:4:2:Operating System:/tmp:nologin
operator:*:2:5:System &:/usr/guest/operator:/bin/csh
bin:*:3:20:Binaries Commands and Source:/:/bin/csh
nobody:*:32767:31:Nobody:/nonexistent:/bin/sh
uucp:*:66:1:UNIX-to-UNIX Copy:/usr/spool/uucppublic:/usr/sbin/uucico
ingres:*:39:74:INGRES Owner:/usr/ingres:/bin/csh

5
etc/shells Normal file
View File

@@ -0,0 +1,5 @@
# List of acceptable shells for chsh/passwd -s
# Ftpd will not allow users to connect who do not have one of these shells
#
/bin/sh
/bin/csh

14
etc/syslog.conf Normal file
View File

@@ -0,0 +1,14 @@
local7.debug /dev/null
*.crit;*.err;kern.debug;auth.notice,local7.none /dev/console
*.err;auth.notice;*.info;kern.debug;local3,local7,mail,daemon,lpr.none /usr/adm/messages
cron.debug /usr/adm/cron
lpr.debug /usr/adm/lpd-errs
mail.debug /usr/spool/mqueue/syslog
mark.debug;daemon.debug /usr/adm/daemonlog
user.debug /usr/adm/debuglog
*.alert;kern.err operator,root
*.emerg *

16
etc/ttys Normal file
View File

@@ -0,0 +1,16 @@
#
# name getty type status comments
#
console "/libexec/getty std.default" vt100 on secure #special
# Enable some of these for additional logins. Do NOT enable the same one as the
# console port, or strange things will happen. You can turn off the console port
# if you would rather use the getty on the real tty - it's up to you.
tty0 "/libexec/getty std.default" vt100 off secure
tty1 "/libexec/getty std.default" vt100 off secure
tty2 "/libexec/getty std.default" vt100 off secure
tty3 "/libexec/getty std.default" vt100 off secure
tty4 "/libexec/getty std.default" vt100 off secure
tty5 "/libexec/getty std.default" vt100 off secure
ttyUSB0 "/libexec/getty std.default" vt100 off secure

99
include/Makefile Normal file
View File

@@ -0,0 +1,99 @@
#
# Copyright (c) 1980 Regents of the University of California.
# All rights reserved. The Berkeley software License Agreement
# specifies the terms and conditions for redistribution.
#
# @(#)Makefile 5.16.1 (2.11BSD GTE) 1997/9/22
#
# Doing a make install builds /usr/include
#
# Define SHARED to indicate whether you want
# symbolic links to the system source (``symlinks''),
# or a separate copy (``copies'').
# (latter useful in environments where it's
# not possible to keep /sys publicly readable)
#
# The ``rm -rf''s used below are safe because rm doesn't
# follow symbolic links.
#
DESTDIR=
SUBDIRS=arpa pascal protocols OLD
STD= a.out.h ar.h assert.h ctype.h curses.h disktab.h fcntl.h \
fstab.h grp.h lastlog.h math.h memory.h mp.h mtab.h ndbm.h \
netdb.h nlist.h pcc.h pwd.h ranlib.h resolv.h setjmp.h \
sgtty.h short_names.h stab.h stdio.h string.h strings.h \
struct.h syscall.h sysexits.h time.h ttyent.h tzfile.h utmp.h \
varargs.h vfont.h vmf.h
LINKS= errno.h signal.h syslog.h
MACHINE=pdp
MACHDEP=${MACHINE} pdpif pdpuba pdpmba vaxuba
NETDIRS=net netimp netinet netns netpup
SYSDIRS=${NETDIRS} ${MACHDEP}
SHARED= symlinks
TAGSFILE=tags
all:
install: ${SHARED}
-for i in ${STD}; do \
cmp -s $$i ${DESTDIR}/usr/include/$$i || \
install -c -m 444 $$i ${DESTDIR}/usr/include/$$i; \
done
-for i in ${SUBDIRS}; do \
if [ ! -d ${DESTDIR}/usr/include/$$i ]; \
then \
mkdir ${DESTDIR}/usr/include/$$i; \
fi; \
(cd $$i; for j in *.[ih]; do \
cmp -s $$j ${DESTDIR}/usr/include/$$i/$$j || \
install -c -m 444 $$j ${DESTDIR}/usr/include/$$i/$$j; \
done); \
done
-cmp -s Makefile.install ${DESTDIR}/usr/include/Makefile || \
install -c -m 444 Makefile.install ${DESTDIR}/usr/include/Makefile
-for i in ${LINKS}; do \
rm -f ${DESTDIR}/usr/include/$$i; \
ln -s sys/$$i ${DESTDIR}/usr/include/$$i; \
done
rm -f ${DESTDIR}/usr/include/machine
ln -s ${MACHINE} ${DESTDIR}/usr/include/machine
rm -f ${DESTDIR}/usr/include/frame.h
ln -s machine/frame.h ${DESTDIR}/usr/include/frame.h
symlinks:
-for i in ${SYSDIRS}; do \
rm -rf ${DESTDIR}/usr/include/$$i; \
if [ ! -s ${DESTDIR}/usr/include/$$i ]; \
then \
ln -s ../../sys/$$i ${DESTDIR}/usr/include/$$i; \
else \
echo ${DESTDIR}/usr/include/$$i not removed; \
fi; \
done
rm -rf ${DESTDIR}/usr/include/sys
-if [ ! -s ${DESTDIR}/usr/include/sys ]; \
then \
ln -s ../../sys/h ${DESTDIR}/usr/include/sys; \
else \
echo ${DESTDIR}/usr/include/sys not removed; \
fi
copies:
-for i in ${SYSDIRS}; do \
rm -rf ${DESTDIR}/usr/include/$$i; \
cd /sys; \
tar cf - $$i/*.h | (cd ${DESTDIR}/usr/include; tar xpfB -); \
done
rm -rf ${DESTDIR}/usr/include/sys;
mkdir ${DESTDIR}/usr/include/sys;
chmod 775 ${DESTDIR}/usr/include/sys;
-(cd /sys/h; tar cf - *.h | (cd ${DESTDIR}/usr/include/sys; tar xpfB -))
tags:
cwd=/usr/include; \
for i in ${STD} ${LINKS}; do \
ctags -a -f ${TAGSFILE} $$cwd/$$i; \
done
clean:
rm -f tags

63
include/Makefile.install Normal file
View File

@@ -0,0 +1,63 @@
#
# Copyright (c) 1983,1986 Regents of the University of California.
# All rights reserved. The Berkeley software License Agreement
# specifies the terms and conditions for redistribution.
#
# @(#)Makefile.install 5.3 (Berkeley) 10/13/86
#
# Makefile for /usr/include, used to convert system include subdirectories
# between symbolic links and copies of kernel headers.
# May also be used to update copies from kernel header files.
#
# The ``rm -rf''s used below are safe because rm doesn't
# follow symbolic links.
#
DESTDIR=
#ifdef vax
#MACHINE=vax
#MACHDEP=${MACHINE} vaxif vaxmba vaxuba
#endif
MACHINE=pdp
MACHDEP=${MACHINE} pdpmba pdpuba stand vaxif vaxuba
NETDIRS=net netimp netinet netns netpup
SYSDIRS=${NETDIRS} ${MACHDEP}
SYS=/sys
all:
@echo "\"make symlinks\", \"make copies\", or \"make update\" only"
@false
symlinks:
for i in ${SYSDIRS}; do \
rm -rf $$i; \
ln -s ../../${SYS}/$$i $$i; \
done
rm -rf sys
ln -s ../../${SYS}/h sys
copies:
-for i in ${SYSDIRS}; do \
rm -rf $$i; \
(cd ${SYS}; tar cf - $$i/*.h) | tar xpfB -; \
done
rm -rf sys;
mkdir sys;
chmod 775 sys;
-(cd ${SYS}/h; tar cf - *.h) | (cd sys; tar xpfB -)
update:
-for i in ${SYSDIRS}; do \
if [ ! -d $$i ]; \
then \
mkdir $$i; \
fi; \
for j in `cd ${SYS}/$$i; echo *.[ih]`; do \
cmp -s ${SYS}/$$i/$$j $$i/$$j || \
install -c -m 444 ${SYS}/$$i/$$j $$i/$$j; \
done; \
done
for j in `cd ${SYS}/h; echo *.[ih]`; do \
cmp -s ${SYS}/h/$$j sys/$$j || \
{ echo "install -c -m 444 ${SYS}/h/$$j sys/$$j"; \
install -c -m 444 ${SYS}/h/$$j sys/$$j; } \
done;

90
include/a.out.h Normal file
View File

@@ -0,0 +1,90 @@
/*-
* Copyright (c) 1991 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#ifndef _AOUT_H_
#define _AOUT_H_
#include <sys/exec.h>
/* Valid magic number check. */
#define N_BADMAG(x) (((x).a_magic) != RMAGIC && \
((x).a_magic) != OMAGIC && \
((x).a_magic) != NMAGIC)
/* Text segment offset. */
#define N_TXTOFF(x) sizeof(struct exec)
/* Data segment offset. */
#define N_DATOFF(x) (N_TXTOFF(x) + (x).a_text)
/* Text relocation table offset. */
#define N_TRELOFF(x) (N_DATOFF(x) + (x).a_data)
/* Data relocation table offset. */
#define N_DRELOFF(x) (N_TRELOFF(x) + (x).a_reltext)
/* Symbol table offset. */
#define N_SYMOFF(x) ((x).a_magic == RMAGIC ? \
N_DRELOFF(x) + (x).a_reldata : \
N_DATOFF(x) + (x).a_data)
#define _AOUT_INCLUDE_
#include <nlist.h>
/* Relocations */
struct reloc {
unsigned flags;
#define RSMASK 0x70 /* bitmask for segments */
#define RABS 0
#define RTEXT 0x20
#define RDATA 0x30
#define RBSS 0x40
#define RSTRNG 0x60 /* for assembler */
#define REXT 0x70 /* externals and bitmask */
#define RGPREL 0x08 /* gp relative */
#define RFMASK 0x07 /* bitmask for format */
#define RBYTE16 0x00 /* low part of byte address: bits 15:0 */
#define RBYTE32 0x01 /* 32-bit byte address */
#define RHIGH16 0x02 /* upper part of byte address: bits 31:16 */
#define RHIGH16S 0x03 /* upper part of address with signed offset */
#define RWORD16 0x04 /* word address: bits 17:2 */
#define RWORD26 0x05 /* word address: bits 27:2 */
unsigned index; /* 24-bit index in symbol table,
* for REXT */
unsigned offset; /* 16-bit offset,
* for RIGH16 and RIGH16S */
};
#endif /* !_AOUT_H_ */

15
include/alloca.h Normal file
View File

@@ -0,0 +1,15 @@
/* alloca.h - Allocate memory on stack */
#ifndef ALLOCA_H
#define ALLOCA_H
#undef alloca
#ifdef __GNUC__
#define alloca(size) __builtin_alloca(size)
#else
#include <sys/types.h>
void *alloca(size_t);
#endif
#endif

58
include/ar.h Normal file
View File

@@ -0,0 +1,58 @@
/*-
* Copyright (c) 1991 The Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Hugh Smith at The University of Guelph.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#ifndef _AR_H_
#define _AR_H_
#define ARMAG "!<arch>\n" /* ar "magic number" */
#define SARMAG 8 /* strlen(ARMAG); */
#define AR_EFMT1 "#1/" /* extended format #1 */
struct ar_hdr {
char ar_name[16]; /* name */
char ar_date[12]; /* modification time */
char ar_uid[6]; /* user id */
char ar_gid[6]; /* group id */
char ar_mode[8]; /* octal file permissions */
char ar_size[10]; /* size in bytes */
#define ARFMAG "`\n"
char ar_fmag[2]; /* consistency check */
};
#define ARHDRSZ 60
#endif /* !_AR_H_ */

37
include/arpa/inet.h Normal file
View File

@@ -0,0 +1,37 @@
/*
* Copyright (c) 1983 Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms are permitted
* provided that the above copyright notice and this paragraph are
* duplicated in all such forms and that any documentation,
* advertising materials, and other materials related to such
* distribution and use acknowledge that the software was developed
* by the University of California, Berkeley. The name of the
* University may not be used to endorse or promote products derived
* from this software without specific prior written permission.
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
/*
* External definitions for
* functions in inet(3N)
*/
struct in_addr;
unsigned long inet_addr (char *);
char *inet_ntoa (struct in_addr);
struct in_addr inet_makeaddr (long, long);
unsigned long inet_network (char *);
unsigned long inet_netof (struct in_addr);
unsigned long inet_lnaof (struct in_addr);
/*
* Macros for number representation conversion.
*/
unsigned htonl (unsigned hostlong);
unsigned htons (unsigned hostshort);
unsigned ntohl (unsigned netlong);
unsigned ntohs (unsigned netshort);

9
include/assert.h Normal file
View File

@@ -0,0 +1,9 @@
/* assert.h 4.2 85/01/21 */
# ifndef NDEBUG
# define _assert(ex) {if (!(ex)){fprintf(stderr,"Assertion failed: file \"%s\", line %d\n", __FILE__, __LINE__);exit(1);}}
# define assert(ex) _assert(ex)
# else
# define _assert(ex)
# define assert(ex)
# endif

28
include/ctype.h Normal file
View File

@@ -0,0 +1,28 @@
/* ctype.h 4.2 85/09/04 */
#define _U 01
#define _L 02
#define _N 04
#define _S 010
#define _P 020
#define _C 040
#define _X 0100
#define _B 0200
extern char _ctype_[];
#define isalpha(c) ((_ctype_+1)[(int)(c)]&(_U|_L))
#define isupper(c) ((_ctype_+1)[(int)(c)]&_U)
#define islower(c) ((_ctype_+1)[(int)(c)]&_L)
#define isdigit(c) ((_ctype_+1)[(int)(c)]&_N)
#define isxdigit(c) ((_ctype_+1)[(int)(c)]&(_N|_X))
#define isspace(c) ((_ctype_+1)[(int)(c)]&_S)
#define ispunct(c) ((_ctype_+1)[(int)(c)]&_P)
#define isalnum(c) ((_ctype_+1)[(int)(c)]&(_U|_L|_N))
#define isprint(c) ((_ctype_+1)[(int)(c)]&(_P|_U|_L|_N|_B))
#define isgraph(c) ((_ctype_+1)[(int)(c)]&(_P|_U|_L|_N))
#define iscntrl(c) ((_ctype_+1)[(int)(c)]&_C)
#define isascii(c) ((unsigned)(c)<=0177)
#define toupper(c) ((c)-'a'+'A')
#define tolower(c) ((c)-'A'+'a')
#define toascii(c) ((c)&0177)

191
include/curses.h Normal file
View File

@@ -0,0 +1,191 @@
/*
* Copyright (c) 1980 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*/
#ifndef CURSES_H
#include <stdio.h>
#include <sgtty.h>
#include <term.h>
#define bool int
#define reg register
#define TRUE (1)
#define FALSE (0)
#define ERR (0)
#define OK (1)
#define _ENDLINE 001
#define _FULLWIN 002
#define _SCROLLWIN 004
#define _FLUSH 010
#define _FULLLINE 020
#define _IDLINE 040
#define _STANDOUT 0200
#define _NOCHANGE -1
#define _puts(s) tputs(s, 0, _putchar)
typedef struct sgttyb SGTTY;
/*
* Capabilities from termcap
*/
extern bool AM, BS, CA, DA, DB, EO, HC, HZ, IN, MI, MS, NC, NS, OS, UL,
XB, XN, XT, XS, XX;
extern char *AL, *BC, *BT, *CD, *CE, *CL, *CM, *CR, *CS, *DC, *DL,
*DM, *DO, *ED, *EI, *K0, *K1, *K2, *K3, *K4, *K5, *K6,
*K7, *K8, *K9, *HO, *IC, *IM, *IP, *KD, *KE, *KH, *KL,
*KR, *KS, *KU, *LL, *MA, *ND, *NL, *RC, *SC, *SE, *SF,
*SO, *SR, *TA, *TE, *TI, *UC, *UE, *UP, *US, *VB, *VS,
*VE, *AL_PARM, *DL_PARM, *UP_PARM, *DOWN_PARM,
*LEFT_PARM, *RIGHT_PARM;
extern char PC;
/*
* From the tty modes...
*/
extern bool GT, NONL, UPPERCASE, normtty, _pfast;
struct _win_st {
short _cury, _curx;
short _maxy, _maxx;
short _begy, _begx;
short _flags;
short _ch_off;
bool _clear;
bool _leave;
bool _scroll;
char **_y;
short *_firstch;
short *_lastch;
struct _win_st *_nextp, *_orig;
};
#define WINDOW struct _win_st
extern bool My_term, _echoit, _rawmode, _endwin;
extern char *Def_term, ttytype[];
extern int LINES, COLS, _tty_ch, _res_flg;
extern SGTTY _tty;
extern WINDOW *stdscr, *curscr;
/*
* Define VOID to stop lint from generating "null effect"
* comments.
*/
#ifdef lint
int __void__;
#define VOID(x) (__void__ = (int) (x))
#else
#define VOID(x) (x)
#endif
/*
* psuedo functions for standard screen
*/
#define addch(ch) VOID(waddch(stdscr, ch))
#define getch() VOID(wgetch(stdscr))
#define addstr(str) VOID(waddstr(stdscr, str))
#define getstr(str) VOID(wgetstr(stdscr, str))
#define move(y, x) VOID(wmove(stdscr, y, x))
#define clear() VOID(wclear(stdscr))
#define erase() VOID(werase(stdscr))
#define clrtobot() VOID(wclrtobot(stdscr))
#define clrtoeol() VOID(wclrtoeol(stdscr))
#define insertln() VOID(winsertln(stdscr))
#define deleteln() VOID(wdeleteln(stdscr))
#define refresh() VOID(wrefresh(stdscr))
#define inch() VOID(winch(stdscr))
#define insch(c) VOID(winsch(stdscr,c))
#define delch() VOID(wdelch(stdscr))
#define standout() VOID(wstandout(stdscr))
#define standend() VOID(wstandend(stdscr))
/*
* mv functions
*/
#define mvwaddch(win,y,x,ch) VOID(wmove(win,y,x)==ERR?ERR:waddch(win,ch))
#define mvwgetch(win,y,x) VOID(wmove(win,y,x)==ERR?ERR:wgetch(win))
#define mvwaddstr(win,y,x,str) VOID(wmove(win,y,x)==ERR?ERR:waddstr(win,str))
#define mvwgetstr(win,y,x,str) VOID(wmove(win,y,x)==ERR?ERR:wgetstr(win,str))
#define mvwinch(win,y,x) VOID(wmove(win,y,x) == ERR ? ERR : winch(win))
#define mvwdelch(win,y,x) VOID(wmove(win,y,x) == ERR ? ERR : wdelch(win))
#define mvwinsch(win,y,x,c) VOID(wmove(win,y,x) == ERR ? ERR:winsch(win,c))
#define mvaddch(y,x,ch) mvwaddch(stdscr,y,x,ch)
#define mvgetch(y,x) mvwgetch(stdscr,y,x)
#define mvaddstr(y,x,str) mvwaddstr(stdscr,y,x,str)
#define mvgetstr(y,x,str) mvwgetstr(stdscr,y,x,str)
#define mvinch(y,x) mvwinch(stdscr,y,x)
#define mvdelch(y,x) mvwdelch(stdscr,y,x)
#define mvinsch(y,x,c) mvwinsch(stdscr,y,x,c)
/*
* psuedo functions
*/
#define clearok(win,bf) (win->_clear = bf)
#define leaveok(win,bf) (win->_leave = bf)
#define scrollok(win,bf) (win->_scroll = bf)
#define flushok(win,bf) (bf ? (win->_flags |= _FLUSH):(win->_flags &= ~_FLUSH))
#define getyx(win,y,x) y = win->_cury, x = win->_curx
#define winch(win) (win->_y[win->_cury][win->_curx] & 0177)
#define raw() (_tty.sg_flags|=RAW, _pfast=_rawmode=TRUE, ioctl(_tty_ch,TIOCSETP,&_tty))
#define noraw() (_tty.sg_flags&=~RAW,_rawmode=FALSE,_pfast=!(_tty.sg_flags&CRMOD),ioctl(_tty_ch,TIOCSETP,&_tty))
#define cbreak() (_tty.sg_flags |= CBREAK, _rawmode = TRUE, ioctl(_tty_ch,TIOCSETP,&_tty))
#define nocbreak() (_tty.sg_flags &= ~CBREAK,_rawmode=FALSE,ioctl(_tty_ch,TIOCSETP,&_tty))
#define crmode() cbreak() /* backwards compatability */
#define nocrmode() nocbreak() /* backwards compatability */
#define echo() (_tty.sg_flags |= ECHO, _echoit = TRUE, ioctl(_tty_ch, TIOCSETP, &_tty))
#define noecho() (_tty.sg_flags &= ~ECHO, _echoit = FALSE, ioctl(_tty_ch, TIOCSETP, &_tty))
#define nl() (_tty.sg_flags |= CRMOD, _pfast = _rawmode,ioctl(_tty_ch, TIOCSETP, &_tty))
#define nonl() (_tty.sg_flags &= ~CRMOD,_pfast = TRUE, ioctl(_tty_ch, TIOCSETP,&_tty))
#define savetty() ((void) ioctl(_tty_ch, TIOCGETP, &_tty), _res_flg = _tty.sg_flags)
#define resetty() (_tty.sg_flags = _res_flg, (void) ioctl(_tty_ch, TIOCSETP, &_tty))
#define erasechar() (_tty.sg_erase)
#define killchar() (_tty.sg_kill)
#define baudrate() (_tty.sg_ospeed)
WINDOW *initscr(), *newwin(), *subwin();
char *longname(), *getcap();
int wmove (WINDOW *, int, int);
int wrefresh (WINDOW *);
int wclear (WINDOW *);
int waddch (WINDOW *, char);
int wgetch (WINDOW *);
char *wstandout (WINDOW *);
char *wstandend (WINDOW *);
int touchwin (WINDOW *);
int touchline (WINDOW *, int, int, int);
void box (WINDOW *, char, char);
void endwin (void);
int printw (char *, ...);
int wprintw (WINDOW *, char *, ...);
int scroll (WINDOW *);
void wclrtoeol (WINDOW *);
void werase (WINDOW *);
int setterm (char *);
int delwin (WINDOW *);
int waddstr (WINDOW *, char *);
int wgetstr (WINDOW *, char *);
int wdeleteln (WINDOW *);
void mvcur(int ly, int lx, int y, int x);
/*
* Used to be in unctrl.h.
*/
#define unctrl(c) _unctrl[(c) & 0177]
extern char *_unctrl[];
#endif

28
include/dbm.h Normal file
View File

@@ -0,0 +1,28 @@
/*
* Copyright (c) 1980 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
* @(#)dbm.h 5.1 (Berkeley) 3/27/86
*/
#ifndef NULL
/*
* this is lunacy, we no longer use it (and never should have
* unconditionally defined it), but, this whole file is for
* backwards compatability - someone may rely on this.
*/
#define NULL ((char *) 0)
#endif
#include <ndbm.h>
datum fetch();
datum firstkey();
datum nextkey();
#if 0
datum makdatum();
datum firsthash();
long calchash();
long hashinc();
#endif

1
include/errno.h Symbolic link
View File

@@ -0,0 +1 @@
sys/errno.h

51
include/fcntl.h Normal file
View File

@@ -0,0 +1,51 @@
/*-
* Copyright (c) 1983, 1990, 1993
* The Regents of the University of California. All rights reserved.
* (c) UNIX System Laboratories, Inc.
* All or some portions of this file are derived from material licensed
* to the University of California by American Telephone and Telegraph
* Co. or Unix System Laboratories, Inc. and are reproduced herein with
* the permission of UNIX System Laboratories, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)fcntl.h 8.3.1 (2.11BSD GTE) 11/25/94
*
* Copied from 4.4-Lite and modified for 2.11BSD. The modifications consisted
* of removing: function prototypes (I don't like them, the compiler does not
* support them, and it would mean dragging in cdefs.h to leave them in here),
* #ifndef _POSIX_SOURCE lines (silly) and record locking related definitions
* If anyone adds any of the above it will be easy enough to modify this file.
* In the meantime why bog down (or blow up) cpp any further?
*/
#include <sys/fcntl.h>
int open (const char *path, int oflag, ...);
int creat (const char *path, mode_t mode);
int fcntl (int fildes, int cmd, ...);

6
include/float.h Normal file
View File

@@ -0,0 +1,6 @@
#ifndef _FLOAT_H_
#define _FLOAT_H_
#include <machine/float.h>
#endif /* _FLOAT_H_ */

75
include/fstab.h Normal file
View File

@@ -0,0 +1,75 @@
/*
* Copyright (c) 1980, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)fstab.h 8.1.1 (2.11BSD) 1996/1/15
*/
#ifndef _FSTAB_H_
#define _FSTAB_H_
/*
* File system table, see fstab(5).
*
* Used by dump, mount, umount, swapon, fsck, df, ...
*
* For ufs fs_spec field is the block special name. Programs that want to
* use the character special name must create that name by prepending a 'r'
* after the right most slash. Quota files are always named "quotas", so
* if type is "rq", then use concatenation of fs_file and "quotas" to locate
* quota file.
*/
#define _PATH_FSTAB "/etc/fstab"
#define FSTAB "/etc/fstab" /* deprecated */
#define FSTAB_RW "rw" /* read/write device */
#define FSTAB_RQ "rq" /* read/write with quotas */
#define FSTAB_RO "ro" /* read-only device */
#define FSTAB_SW "sw" /* swap device */
#define FSTAB_XX "xx" /* ignore totally */
struct fstab {
char *fs_spec; /* block special device name */
char *fs_file; /* file system path prefix */
char *fs_vfstype; /* File system type, ufs, nfs */
char *fs_mntops; /* Mount options ala -o */
char *fs_type; /* FSTAB_* from fs_mntops */
int fs_freq; /* dump frequency, in days */
int fs_passno; /* pass number on parallel dump */
};
struct fstab *getfsent();
struct fstab *getfsspec();
struct fstab *getfsfile();
int setfsent();
void endfsent();
#endif /* !_FSTAB_H_ */

15
include/grp.h Normal file
View File

@@ -0,0 +1,15 @@
/* grp.h 4.1 83/05/03 */
struct group { /* see getgrent(3) */
char *gr_name;
char *gr_passwd;
int gr_gid;
char **gr_mem;
};
struct group *getgrent(void);
struct group *getgrnam(const char *name);
struct group *getgrgid(gid_t gid);
void setgrent(void);
void endgrent(void);
int setgroups(size_t size, const gid_t *list);

6
include/kmem.h Normal file
View File

@@ -0,0 +1,6 @@
#ifndef _KMEM_H
#define _KMEM_H
extern dev_t kmemdev();
#endif

13
include/lastlog.h Normal file
View File

@@ -0,0 +1,13 @@
/*
* Copyright (c) 1980 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
* @(#)lastlog.h 5.1 (Berkeley) 5/30/85
*/
struct lastlog {
time_t ll_time;
char ll_line[8];
char ll_host[16]; /* same as in utmp */
};

71
include/limits.h Normal file
View File

@@ -0,0 +1,71 @@
/*
* Copyright (c) 1988, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)limits.h 8.2.1 (2.11BSD) 1996/1/11
*/
#ifndef _LIMITS_H_
#define _LIMITS_H_
/*
* We don't need this crud at the moment so save on abuse of the C
* preprocessor by not doing the defines.
#define _POSIX_ARG_MAX 4096
#define _POSIX_CHILD_MAX 6
#define _POSIX_LINK_MAX 8
#define _POSIX_MAX_CANON 255
#define _POSIX_MAX_INPUT 255
#define _POSIX_NAME_MAX 14
#define _POSIX_NGROUPS_MAX 0
#define _POSIX_OPEN_MAX 16
#define _POSIX_PATH_MAX 255
#define _POSIX_PIPE_BUF 512
#define _POSIX_SSIZE_MAX 32767
#define _POSIX_STREAM_MAX 8
#define _POSIX_TZNAME_MAX 3
#define _POSIX2_BC_BASE_MAX 99
#define _POSIX2_BC_DIM_MAX 2048
#define _POSIX2_BC_SCALE_MAX 99
#define _POSIX2_BC_STRING_MAX 1000
#define _POSIX2_EQUIV_CLASS_MAX 2
#define _POSIX2_EXPR_NEST_MAX 32
#define _POSIX2_LINE_MAX 2048
#define _POSIX2_RE_DUP_MAX 255
*/
#include <machine/limits.h>
/* #include <sys/syslimits.h> */
#endif /* !_LIMITS_H_ */

1
include/machine Symbolic link
View File

@@ -0,0 +1 @@
pic32

33
include/math.h Normal file
View File

@@ -0,0 +1,33 @@
/*
* Copyright (c) 1986 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*/
extern double fabs(), floor(), ceil(), fmod(), ldexp();
extern double sqrt(), hypot(), atof();
extern double sin(), cos(), tan(), asin(), acos(), atan(), atan2();
extern double exp(), log(), log10(), pow();
extern double sinh(), cosh(), tanh();
extern double gamma();
extern double j0(), j1(), jn(), y0(), y1(), yn();
#define HUGE 1.701411733192644270e38
#define LOGHUGE 39
int isnanf(float x);
int isnan(double x);
int isinff(float x);
int isinf(double x);
float modff(float x, float *iptr);
double modf(double x, double *iptr);
float frexpf(float x, int *exp);
double frexp(double x, int *exp);
float ldexpf(float x, int exp);
double ldexp(double x, int exp);
double fmod(double x, double y);

16
include/mtab.h Normal file
View File

@@ -0,0 +1,16 @@
/*
* Copyright (c) 1980 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
* @(#)mtab.h 5.1 (Berkeley) 5/30/85
*/
/*
* Mounted device accounting file.
*/
struct mtab {
char m_path[32]; /* mounted on pathname */
char m_dname[32]; /* block device pathname */
char m_type[4]; /* read-only, quotas */
};

66
include/ndbm.h Normal file
View File

@@ -0,0 +1,66 @@
/*
* Copyright (c) 1983 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
* @(#)ndbm.h 5.1.1 (2.11BSD GTE) 12/31/93
*/
/*
* Hashed key data base library.
*/
#define PBLKSIZ 1024
#ifdef pdp11
#define DBLKSIZ 512
#else
#define DBLKSIZ 4096
#endif
typedef struct {
int dbm_dirf; /* open directory file */
int dbm_pagf; /* open page file */
int dbm_flags; /* flags, see below */
long dbm_maxbno; /* last ``bit'' in dir file */
long dbm_bitno; /* current bit number */
long dbm_hmask; /* hash mask */
long dbm_blkptr; /* current block for dbm_nextkey */
int dbm_keyptr; /* current key for dbm_nextkey */
long dbm_blkno; /* current page to read/write */
long dbm_pagbno; /* current page in pagbuf */
char dbm_pagbuf[PBLKSIZ]; /* page file block buffer */
long dbm_dirbno; /* current block in dirbuf */
char dbm_dirbuf[DBLKSIZ]; /* directory file block buffer */
} DBM;
#define _DBM_RDONLY 0x1 /* data base open read-only */
#define _DBM_IOERR 0x2 /* data base I/O error */
#define dbm_rdonly(db) ((db)->dbm_flags & _DBM_RDONLY)
#define dbm_error(db) ((db)->dbm_flags & _DBM_IOERR)
/* use this one at your own risk! */
#define dbm_clearerr(db) ((db)->dbm_flags &= ~_DBM_IOERR)
/* for flock(2) and fstat(2) */
#define dbm_dirfno(db) ((db)->dbm_dirf)
#define dbm_pagfno(db) ((db)->dbm_pagf)
typedef struct {
char *dptr;
int dsize;
} datum;
/*
* flags to dbm_store()
*/
#define DBM_INSERT 0
#define DBM_REPLACE 1
DBM *dbm_open();
void dbm_close();
datum dbm_fetch();
datum dbm_firstkey();
datum dbm_nextkey();
long dbm_forder();
int dbm_delete();
int dbm_store();

165
include/netinet/in.h Normal file
View File

@@ -0,0 +1,165 @@
/*
* Copyright (c) 1982, 1986 Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms are permitted
* provided that this notice is preserved and that due credit is given
* to the University of California at Berkeley. The name of the University
* may not be used to endorse or promote products derived from this
* software without specific prior written permission. This software
* is provided ``as is'' without express or implied warranty.
*/
/*
* Constants and structures defined by the internet system,
* Per RFC 790, September 1981.
*/
/*
* Protocols
*/
#define IPPROTO_IP 0 /* dummy for IP */
#define IPPROTO_ICMP 1 /* control message protocol */
#define IPPROTO_GGP 3 /* gateway^2 (deprecated) */
#define IPPROTO_TCP 6 /* tcp */
#define IPPROTO_EGP 8 /* exterior gateway protocol */
#define IPPROTO_PUP 12 /* pup */
#define IPPROTO_UDP 17 /* user datagram protocol */
#define IPPROTO_IDP 22 /* xns idp */
#define IPPROTO_RAW 255 /* raw IP packet */
#define IPPROTO_MAX 256
/*
* Ports < IPPORT_RESERVED are reserved for
* privileged processes (e.g. root).
* Ports > IPPORT_USERRESERVED are reserved
* for servers, not necessarily privileged.
*/
#define IPPORT_RESERVED 1024
#define IPPORT_USERRESERVED 5000
/*
* Link numbers
*/
#define IMPLINK_IP 155
#define IMPLINK_LOWEXPER 156
#define IMPLINK_HIGHEXPER 158
/*
* Internet address (a structure for historical reasons)
*/
struct in_addr {
u_long s_addr;
};
/*
* Definitions of bits in internet address integers.
* On subnets, the decomposition of addresses to host and net parts
* is done according to subnet mask, not the masks here.
*/
#define IN_CLASSA(i) (((long)(i) & 0x80000000L) == 0)
#define IN_CLASSA_NET 0xff000000L
#define IN_CLASSA_NSHIFT 24
#define IN_CLASSA_HOST 0x00ffffffL
#define IN_CLASSA_MAX 128
#define IN_CLASSB(i) (((long)(i) & 0xc0000000L) == 0x80000000L)
#define IN_CLASSB_NET 0xffff0000L
#define IN_CLASSB_NSHIFT 16
#define IN_CLASSB_HOST 0x0000ffffL
#define IN_CLASSB_MAX 65536
#define IN_CLASSC(i) (((long)(i) & 0xe0000000L) == 0xc0000000L)
#define IN_CLASSC_NET 0xffffff00L
#define IN_CLASSC_NSHIFT 8
#define IN_CLASSC_HOST 0x000000ffL
#define IN_CLASSD(i) (((long)(i) & 0xf0000000L) == 0xe0000000L)
#define IN_MULTICAST(i) IN_CLASSD(i)
#define IN_EXPERIMENTAL(i) (((long)(i) & 0xe0000000L) == 0xe0000000L)
#define IN_BADCLASS(i) (((long)(i) & 0xf0000000L) == 0xf0000000L)
#define INADDR_ANY 0x00000000L
#define INADDR_BROADCAST 0xffffffffL /* must be masked */
#ifndef KERNEL
#define INADDR_NONE 0xffffffffL /* -1 return */
#endif
#define IN_LOOPBACKNET 127 /* official! */
/*
* Socket address, internet style.
*/
struct sockaddr_in {
short sin_family;
u_short sin_port;
struct in_addr sin_addr;
char sin_zero[8];
};
/*
* Options for use with [gs]etsockopt at the IP level.
*/
#define IP_OPTIONS 1 /* set/get IP per-packet options */
/*
* Definitions for inet sysctl operations.
*
* Third level is protocol number.
* Fourth level is desired variable within that protocol.
*/
#define IPPROTO_MAXID (IPPROTO_IDP + 1) /* don't list to IPPROTO_MAX */
#ifndef KERNEL
#define CTL_IPPROTO_NAMES { \
{ "ip", CTLTYPE_NODE }, \
{ "icmp", CTLTYPE_NODE }, \
{ "igmp", CTLTYPE_NODE }, \
{ 0, 0 }, \
{ 0, 0 }, \
{ 0, 0 }, \
{ "tcp", CTLTYPE_NODE }, \
{ 0, 0 }, \
{ 0, 0 }, \
{ 0, 0 }, \
{ 0, 0 }, \
{ 0, 0 }, \
{ 0, 0 }, \
{ 0, 0 }, \
{ 0, 0 }, \
{ 0, 0 }, \
{ 0, 0 }, \
{ "udp", CTLTYPE_NODE }, \
{ 0, 0 }, \
{ 0, 0 }, \
{ 0, 0 }, \
{ 0, 0 }, \
{ "idp", CTLTYPE_NODE }, \
}
#endif /* KERNEL */
/*
* Names for IP sysctl objects
*/
#define IPCTL_FORWARDING 1 /* act as router */
#define IPCTL_SENDREDIRECTS 2 /* may send redirects when forwarding */
#define IPCTL_DEFTTL 3 /* default TTL */
#ifdef notyet
#define IPCTL_DEFMTU 4 /* default MTU */
#endif
#define IPCTL_FORWSRCRT 5 /* forward source-routed dgrams */
#define IPCTL_MAXID 6
#ifndef KERNEL
#define IPCTL_NAMES { \
{ 0, 0 }, \
{ "forwarding", CTLTYPE_INT }, \
{ "redirect", CTLTYPE_INT }, \
{ "ttl", CTLTYPE_INT }, \
{ "mtu", CTLTYPE_INT }, \
{ "forwsrcrt", CTLTYPE_INT }, \
}
#endif /* KERNEL */

75
include/nlist.h Normal file
View File

@@ -0,0 +1,75 @@
/*-
* Copyright (c) 1991 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#ifndef _NLIST_H_
#define _NLIST_H_
#include <sys/types.h>
/*
* Symbol table entry format.
*/
struct nlist {
char *n_name; /* In memory address of symbol name,
or string table offset (file) */
u_short n_len; /* Length of name in bytes */
u_short n_type; /* Type of symbol - see below */
u_int n_value; /* Symbol value */
};
/*
* Simple values for n_type.
*/
#define N_UNDF 0x00 /* undefined */
#define N_ABS 0x01 /* absolute */
#define N_TEXT 0x02 /* text segment */
#define N_DATA 0x03 /* data segment */
#define N_BSS 0x04 /* bss segment */
#define N_STRNG 0x05 /* string segment (for assembler) */
#define N_COMM 0x06 /* .comm segment (for assembler) */
#define N_FN 0x1f /* file name */
#define N_TYPE 0x1f /* mask for all the type bits */
#define N_EXT 0x20 /* external (global) bit, OR'ed in */
#define N_WEAK 0x40 /* weak reference bit, OR'ed in */
#define N_LOC 0x80 /* local, for assembler */
/*
* Get symbols from a file.
*/
int nlist (char *name, struct nlist *list);
/*
* Get kernel symbols.
*/
int knlist (struct nlist *list);
#endif /* !_NLIST_H_ */

59
include/paths.h Normal file
View File

@@ -0,0 +1,59 @@
/*
* Copyright (c) 1989 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms are permitted
* provided that the above copyright notice and this paragraph are
* duplicated in all such forms and that any documentation,
* advertising materials, and other materials related to such
* distribution and use acknowledge that the software was developed
* by the University of California, Berkeley. The name of the
* University may not be used to endorse or promote products derived
* from this software without specific prior written permission.
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
#define _PATH_BSHELL "/bin/sh"
#define _PATH_CSHELL "/bin/csh"
#define _PATH_CP "/bin/cp"
#define _PATH_ECHO "/bin/echo"
#define _PATH_MORE "/bin/more"
#define _PATH_RSH "/bin/rsh"
#define _PATH_VI "/bin/vi"
#define _PATH_CORE "/core"
#define _PATH_DEV "/dev/"
#define _PATH_CONSOLE "/dev/console"
#define _PATH_DEVNULL "/dev/null"
#define _PATH_TTY "/dev/tty"
#define _PATH_MEM "/dev/mem"
#define _PATH_SWAP "/dev/swap"
#define _PATH_LOCALTIME "/etc/localtime"
#define _PATH_MOTD "/etc/motd"
#define _PATH_NOLOGIN "/etc/nologin"
#define _PATH_USRLIB "/lib/"
#define _PATH_CTIMED "/libexec/ctimed"
#define _PATH_LOCALLIB "/local/lib/"
#define _PATH_SBIN "/sbin/"
#define _PATH_USRSBIN "/sbin/"
#define _PATH_SENDMAIL "/sbin/sendmail"
#define _PATH_SHARE "/share/"
#define _PATH_ZONEINFO "/share/zoneinfo" /* Time zone object file directory */
#define _PATH_TMP "/tmp/"
#define _PATH_USRTMP "/tmp/"
#define _PATH_LASTLOG "/var/log/lastlog"
#define _PATH_MESSAGES "/var/log/messages"
#define _PATH_WTMP "/var/log/wtmp"
#define _PATH_MAIL "/var/mail/"
#define _PATH_VARRUN "/var/run/"
#define _PATH_DEVDB "/var/run/dev"
#define _PATH_UTMP "/var/run/utmp"
#define _PATH_ARTMP "/tmp/ar.XXXXXX"
#define _PATH_RANTMP "/tmp/ranlib.XXXXXX"
#define _PATH_STDPATH "/bin"
#define _PATH_SYSPATH "/bin:/sbin:/local"
#define _PATH_MAN "/share/man:/local/man"
#define _PATH_LOCALMAN "/local/man"
#define _PATH_HUSHLOGIN ".hushlogin"

229
include/pcc.h Normal file
View File

@@ -0,0 +1,229 @@
/*
* Copyright (c) 1983 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
* @(#)pcc.h 5.1 (Berkeley) 5/30/85
*/
/*
* This file contains definitions for all the constants and structures
* needed to use the intermediate code files generated and read by
* the Portable C Compiler and related compilers.
*
* Rules for changing this code:
* 1) All op values must be integer constants -- this permits us to run
* a 'sed' script on this file to create %term declarations for yacc.
* 2) Because the PCC uses fancy ASG and UNARY macros, assignment
* operators must have values 1 greater than corresponding normal
* operators, and unary operators must have values 2 greater ditto.
* 3) Ops used only by f1 must have values >= 150 (PCCF_FORTOPS).
* 4) Other language-dependent ops must have values >= 200.
*/
# ifndef PCC_TOKENS
# define PCC_TOKENS 0
# define PCC_ERROR 1 /* an error node */
# define PCC_FREE 2 /* an unused node */
/*
* Constants.
*/
# define PCC_STRING 3 /* a string constant */
# define PCC_ICON 4 /* an integer constant */
# define PCC_FCON 5 /* a floating point constant */
# define PCC_DCON 6 /* a double precision f.p. constant */
/*
* Leaf types.
*/
# define PCC_NAME 7 /* an identifier */
# define PCC_REG 8 /* a register */
# define PCC_OREG 9 /* register and offset */
# define PCC_CCODES 10 /* condition codes */
# define PCC_FLD 11 /* a bit field */
/*
* Arithmetic operators.
*/
# define PCC_PLUS 12 /* + */
# define PCC_PLUSEQ 13 /* += */
# define PCC_UPLUS 14 /* unary + (for completeness) */
# define PCC_MINUS 15 /* - */
# define PCC_MINUSEQ 16 /* -= */
# define PCC_UMINUS 17 /* unary - */
# define PCC_MUL 18 /* * */
# define PCC_MULEQ 19 /* *= */
/* Reserve a slot for 'unary *', which is PCC jargon for PCC_DEREF (yech) */
# define PCC_DIV 21 /* / */
# define PCC_DIVEQ 22 /* /= */
# define PCC_MOD 23 /* % */
# define PCC_MODEQ 24 /* %= */
# define PCC_INCR 25 /* ++ */
# define PCC_DECR 26 /* -- */
# define PCC_ASSIGN 27 /* = (these last 3 are stretching it) */
/*
* Bit operators.
*/
# define PCC_AND 28 /* & */
# define PCC_ANDEQ 29 /* &= */
/* Reserve a slot for 'unary &', jargon for PCC_ADDROF */
# define PCC_OR 31 /* | */
# define PCC_OREQ 32 /* |= */
# define PCC_ER 33 /* ^ */
# define PCC_EREQ 34 /* ^= */
# define PCC_LS 35 /* << */
# define PCC_LSEQ 36 /* <<= */
# define PCC_RS 37 /* >> */
# define PCC_RSEQ 38 /* >>= */
# define PCC_COMPL 39 /* ~ */
/*
* Booleans.
*/
# define PCC_EQ 40 /* == */
# define PCC_NE 41 /* != */
# define PCC_LE 42 /* <= */
# define PCC_LT 43 /* < */
# define PCC_GE 44 /* >= */
# define PCC_GT 45 /* > */
# define PCC_ULE 46 /* unsigned <= */
# define PCC_ULT 47 /* unsigned < */
# define PCC_UGE 48 /* unsigned >= */
# define PCC_UGT 49 /* unsigned > */
# define PCC_QUEST 50 /* ? (for conditional expressions) */
# define PCC_COLON 51 /* : (for conditional expressions) */
# define PCC_ANDAND 52 /* && */
# define PCC_OROR 53 /* || */
# define PCC_NOT 54 /* ! */
/*
* Function calls.
*/
# define PCC_CALL 55 /* call by value */
/* no ASG */
# define PCC_UCALL 57 /* call with no arguments */
# define PCC_FORTCALL 58 /* call by reference? */
/* no ASG */
# define PCC_UFORTCALL 60 /* ??? */
# ifdef INLINE
# define PCC_INLINE 61 /* inline function */
/* no ASG */
# define PCC_UINLINE 63 /* inline with no arguments */
# endif INLINE
/*
* Referencing and dereferencing.
*/
# define PCC_DEREF 20 /* * */
# define PCC_ADDROF 30 /* & */
/*
* Special structure operators.
*/
# define PCC_DOT 64 /* . */
# define PCC_STREF 65 /* -> */
# define PCC_STASG 66 /* structure assignment */
# define PCC_STARG 67 /* an argument of type structure */
# define PCC_STCALL 68 /* a function of type structure */
/* no ASG */
# define PCC_USTCALL 70 /* unary structure function */
/*
* Conversions.
*/
# define PCC_SCONV 71 /* scalar conversion */
# define PCC_PCONV 72 /* pointer conversion */
# define PCC_PMCONV 73 /* pointer multiply conversion */
# define PCC_PVCONV 74 /* pointer divide conversion */
# define PCC_CAST 75 /* redundant? */
/*
* Bracket types.
*/
# define PCC_LB 76 /* [ */
# define PCC_RB 77 /* ] */
/*
* Comma nodes.
*/
# define PCC_COMOP 78 /* , (in expressions) */
# define PCC_CM 79 /* , (in argument lists) */
/*
* Miscellaneous.
*/
# define PCC_FORCE 80 /* result of last expression goes in r0 */
# define PCC_GOTO 81 /* unconditional goto */
# define PCC_CBRANCH 82 /* goto label if !test */
# define PCC_RETURN 83 /* return from function */
# define PCC_INIT 84 /* initialized data */
# define PCC_TYPE 85 /* a type */
# define PCC_CLASS 86 /* a storage class */
# define PCC_MAXOP 86 /* highest numbered PCC op */
/*
* Special codes for interfacing to /lib/f1.
*/
# define PCCF_FORTOPS 150
# define PCCF_FTEXT 150 /* pass literal assembler text */
# define PCCF_FEXPR 151 /* a statement */
# define PCCF_FSWITCH 152 /* not implemented */
# define PCCF_FLBRAC 153 /* beginning of subroutine */
# define PCCF_FRBRAC 154 /* end of subroutine */
# define PCCF_FEOF 155 /* end of file */
# define PCCF_FARIF 156 /* not implemented */
# define PCCF_FLABEL 157 /* an f77 label */
# endif PCC_TOKENS
/*
* Types, as encoded in intermediate file cookies.
*/
# define PCCT_UNDEF 0
# define PCCT_FARG 1 /* function argument */
# define PCCT_CHAR 2
# define PCCT_SHORT 3
# define PCCT_INT 4
# define PCCT_LONG 5
# define PCCT_FLOAT 6
# define PCCT_DOUBLE 7
# define PCCT_STRTY 8
# define PCCT_UNIONTY 9
# define PCCT_ENUMTY 10
# define PCCT_MOETY 11 /* member of enum */
# define PCCT_UCHAR 12
# define PCCT_USHORT 13
# define PCCT_UNSIGNED 14
# define PCCT_ULONG 15
/*
* Type modifiers.
*/
# define PCCTM_PTR 020
# define PCCTM_FTN 040
# define PCCTM_ARY 060
# define PCCTM_BASETYPE 017
# define PCCTM_TYPESHIFT 2
/*
* Useful macros. 'PCCOM' macros apply to ops.
*/
# define PCCOM_ASG 1+
# define PCCOM_UNARY 2+
# define PCCOM_NOASG (-1)+
# define PCCOM_NOUNARY (-2)+
# define PCCM_TRIPLE(op, var, type) \
((op) | ((var) << 8) | (long) (type) << 16)
# define PCCM_TEXT(s) \
PCCM_TRIPLE(PCCF_FTEXT, (strlen(s) + 3) / 4, 0)
# define PCCM_ADDTYPE(t, m) \
((((t) &~ PCCTM_BASETYPE) << PCCTM_TYPESHIFT) | \
(m) | ((t) & PCCTM_BASETYPE))

1
include/pic32 Symbolic link
View File

@@ -0,0 +1 @@
../sys/pic32

40
include/psout.h Normal file
View File

@@ -0,0 +1,40 @@
/*
* Copyright (c) 1986 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*/
/*
* psout: structure output by 'ps -U'.
* Mostly the pre-processed /dev directory.
*/
#ifndef makedev
#include <sys/types.h>
#endif
struct psout {
dev_t o_ttyd; /* u_ttyd */
int o_flag; /* p_flag */
short o_pid; /* p_pid */
char o_tty[3]; /* 1st 2 chars of tty after 'tty' */
char o_stat; /* p_stat */
short o_uid; /* p_uid */
char o_uname[UT_NAMESIZE]; /* login name of process owner */
short o_ppid; /* p_ppid */
char o_cpu; /* p_cpu */
char o_pri; /* p_pri */
char o_nice; /* p_nice */
short o_addr0; /* p_addr[0] */
short o_size; /* p_size */
caddr_t o_wchan; /* p_wchan */
time_t o_utime; /* u_utime */
time_t o_stime; /* u_stime */
time_t o_cutime; /* u_cutime */
time_t o_cstime; /* u_cstime */
short o_pgrp; /* p_pgrp */
int o_sigs; /* sum of SIGINT & SIGQUIT,
if == 2 proc is ignoring both.*/
char o_comm[MAXCOMLEN+1]; /* u_comm */
char o_args[64]; /* best guess at args to process */
};

39
include/pwd.h Normal file
View File

@@ -0,0 +1,39 @@
/*
* Copyright (c) 1988 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms are permitted
* provided that the above copyright notice and this paragraph are
* duplicated in all such forms and that any documentation,
* advertising materials, and other materials related to such
* distribution and use acknowledge that the software was developed
* by the University of California, Berkeley. The name of the
* University may not be used to endorse or promote products derived
* from this software without specific prior written permission.
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
#define _PATH_PASSWD "/etc/passwd"
#define _PATH_SHADOW "/etc/shadow"
#define _PATH_MKPASSWD "/sbin/mkpasswd"
#define _PATH_PTMP "/etc/ptmp"
#define _PW_KEYBYNAME '0'
#define _PW_KEYBYUID '1'
struct passwd {
char *pw_name; /* user name */
char *pw_passwd; /* encrypted password */
int pw_uid; /* user uid */
int pw_gid; /* user gid */
char *pw_gecos; /* real name */
char *pw_dir; /* home directory */
char *pw_shell; /* default shell */
};
struct passwd *getpwent(), *getpwuid(), *getpwnam();
void endpwent(), setpwfile();
int setpwent();
int setpassent (int);

46
include/ranlib.h Normal file
View File

@@ -0,0 +1,46 @@
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#ifndef _RANLIB_H_
#define _RANLIB_H_
#define RANLIBMAG "__.SYMDEF" /* archive file name */
#define RANLIBSKEW 3 /* creation time offset */
struct ranlib {
int ran_len; /* 1 byte - name length in bytes */
unsigned ran_off; /* 4 bytes - file offset */
char *ran_name; /* in memory symbol name */
};
#endif /* !_RANLIB_H_ */

21
include/regexp.h Normal file
View File

@@ -0,0 +1,21 @@
/*
* Definitions etc. for regexp(3) routines.
*
* Caveat: this is V8 regexp(3) [actually, a reimplementation thereof],
* not the System V one.
*/
#define NSUBEXP 10
typedef struct regexp {
char *startp[NSUBEXP];
char *endp[NSUBEXP];
char regstart; /* Internal use only. */
char reganch; /* Internal use only. */
char *regmust; /* Internal use only. */
int regmlen; /* Internal use only. */
char program[1]; /* Unwarranted chumminess with compiler. */
} regexp;
extern regexp *regcomp();
extern int regexec();
extern void regsub();
extern void regerror();

42
include/setjmp.h Normal file
View File

@@ -0,0 +1,42 @@
#ifndef _SETJMP_H
#define _SETJMP_H
/*
* Total 12 registers for MIPS architecture:
* 0 - $s0
* 1 - $s1
* 2 - $s2
* 3 - $s3
* 4 - $s4
* 5 - $s5
* 6 - $s6
* 7 - $s7
* 8 - $s8
* 9 - $ra - return address
* 10 - $gp - global data pointer
* 11 - $sp - stack pointer
* 12 - signal mask saved
* 13 - signal mask
*/
typedef int jmp_buf [14];
typedef jmp_buf sigjmp_buf;
/*
* Save and restore only CPU state.
* Signal mask is not saved.
*/
int _setjmp (jmp_buf env);
void _longjmp (jmp_buf env, int val);
/*
* Save and restore CPU state and signal mask.
*/
int setjmp (jmp_buf env);
void longjmp (jmp_buf env, int val);
/*
* Save and restore CPU state and optionally a signal mask.
* Signal mask is saved only when savesigs is nonzero.
*/
int sigsetjmp (sigjmp_buf env, int savesigs);
void siglongjmp (sigjmp_buf env, int val);
#endif

5
include/sgtty.h Normal file
View File

@@ -0,0 +1,5 @@
/* sgtty.h 4.2 85/01/03 */
#ifndef _IOCTL_
#include <sys/ioctl.h>
#endif

1
include/signal.h Symbolic link
View File

@@ -0,0 +1 @@
sys/signal.h

114
include/smallc/curses.h Normal file
View File

@@ -0,0 +1,114 @@
/*
* SmallC: interface to curses library.
*/
#define WINDOW int
extern WINDOW *stdscr, *curscr;
extern int LINES, COLS;
/*
* pseudo functions for standard screen
*/
#define addch(ch) waddch(stdscr, ch)
#define getch() wgetch(stdscr)
#define addstr(str) waddstr(stdscr, str)
#define getstr(str) wgetstr(stdscr, str)
#define move(y, x) wmove(stdscr, y, x)
#define clear() wclear(stdscr)
#define erase() werase(stdscr)
#define clrtobot() wclrtobot(stdscr)
#define clrtoeol() wclrtoeol(stdscr)
#define insertln() winsertln(stdscr)
#define deleteln() wdeleteln(stdscr)
#define refresh() wrefresh(stdscr)
#define inch() winch(stdscr)
#define insch(c) winsch(stdscr,c)
#define delch() wdelch(stdscr)
#define standout() wstandout(stdscr)
#define standend() wstandend(stdscr)
/*
* mv functions
*/
#define mvwaddch(win,y,x,ch) wmove(win,y,x) == 0 ? 0 : waddch(win,ch)
#define mvwgetch(win,y,x) wmove(win,y,x) == 0 ? 0 : wgetch(win)
#define mvwaddstr(win,y,x,str) wmove(win,y,x) == 0 ? 0 : waddstr(win,str)
#define mvwgetstr(win,y,x,str) wmove(win,y,x) == 0 ? 0 : wgetstr(win,str)
#define mvwinch(win,y,x) wmove(win,y,x) == 0 ? 0 : winch(win)
#define mvwdelch(win,y,x) wmove(win,y,x) == 0 ? 0 : wdelch(win)
#define mvwinsch(win,y,x,c) wmove(win,y,x) == 0 ? 0 : winsch(win,c)
#define mvaddch(y,x,ch) mvwaddch(stdscr,y,x,ch)
#define mvgetch(y,x) mvwgetch(stdscr,y,x)
#define mvaddstr(y,x,str) mvwaddstr(stdscr,y,x,str)
#define mvgetstr(y,x,str) mvwgetstr(stdscr,y,x,str)
#define mvinch(y,x) mvwinch(stdscr,y,x)
#define mvdelch(y,x) mvwdelch(stdscr,y,x)
#define mvinsch(y,x,c) mvwinsch(stdscr,y,x,c)
#ifdef TODO
#define TRUE (1)
#define FALSE (0)
#define ERR (0)
#define OK (1)
/*
* Capabilities from termcap
*/
extern int AM, BS, CA, DA, DB, EO, HC, HZ, IN, MI, MS, NC, NS, OS, UL,
XB, XN, XT, XS, XX;
extern char *AL, *BC, *BT, *CD, *CE, *CL, *CM, *CR, *CS, *DC, *DL,
*DM, *DO, *ED, *EI, *K0, *K1, *K2, *K3, *K4, *K5, *K6,
*K7, *K8, *K9, *HO, *IC, *IM, *IP, *KD, *KE, *KH, *KL,
*KR, *KS, *KU, *LL, *MA, *ND, *NL, *RC, *SC, *SE, *SF,
*SO, *SR, *TA, *TE, *TI, *UC, *UE, *UP, *US, *VB, *VS,
*VE, *AL_PARM, *DL_PARM, *UP_PARM, *DOWN_PARM,
*LEFT_PARM, *RIGHT_PARM;
extern char PC;
/*
* From the tty modes...
*/
extern int GT, NONL, UPPERCASE, normtty, _pfast;
extern int My_term, _echoit, _rawmode, _endwin;
extern char *Def_term, ttytype[];
extern int _tty_ch, _res_flg;
extern SGTTY _tty;
/*
* pseudo functions
*/
#define clearok(win,bf) (win->_clear = bf)
#define leaveok(win,bf) (win->_leave = bf)
#define scrollok(win,bf) (win->_scroll = bf)
#define flushok(win,bf) (bf ? (win->_flags |= _FLUSH):(win->_flags &= ~_FLUSH))
#define getyx(win,y,x) y = win->_cury, x = win->_curx
#define winch(win) (win->_y[win->_cury][win->_curx] & 0177)
#define raw() (_tty.sg_flags|=RAW, _pfast=_rawmode=TRUE, ioctl(_tty_ch,TIOCSETP,&_tty))
#define noraw() (_tty.sg_flags&=~RAW,_rawmode=FALSE,_pfast=!(_tty.sg_flags&CRMOD),ioctl(_tty_ch,TIOCSETP,&_tty))
#define cbreak() (_tty.sg_flags |= CBREAK, _rawmode = TRUE, ioctl(_tty_ch,TIOCSETP,&_tty))
#define nocbreak() (_tty.sg_flags &= ~CBREAK,_rawmode=FALSE,ioctl(_tty_ch,TIOCSETP,&_tty))
#define echo() (_tty.sg_flags |= ECHO, _echoit = TRUE, ioctl(_tty_ch, TIOCSETP, &_tty))
#define noecho() (_tty.sg_flags &= ~ECHO, _echoit = FALSE, ioctl(_tty_ch, TIOCSETP, &_tty))
#define nl() (_tty.sg_flags |= CRMOD, _pfast = _rawmode,ioctl(_tty_ch, TIOCSETP, &_tty))
#define nonl() (_tty.sg_flags &= ~CRMOD,_pfast = TRUE, ioctl(_tty_ch, TIOCSETP,&_tty))
#define savetty() ((void) ioctl(_tty_ch, TIOCGETP, &_tty), _res_flg = _tty.sg_flags)
#define resetty() (_tty.sg_flags = _res_flg, (void) ioctl(_tty_ch, TIOCSETP, &_tty))
#define erasechar() (_tty.sg_erase)
#define killchar() (_tty.sg_kill)
#define baudrate() (_tty.sg_ospeed)
/*
* Used to be in unctrl.h.
*/
#define unctrl(c) _unctrl[(c) & 0177]
extern char *_unctrl[];
#endif

38
include/smallc/fcntl.h Normal file
View File

@@ -0,0 +1,38 @@
/* open-only flags */
#define O_RDONLY 0x0000 /* open for reading only */
#define O_WRONLY 0x0001 /* open for writing only */
#define O_RDWR 0x0002 /* open for reading and writing */
#define O_ACCMODE 0x0003 /* mask for above modes */
#define O_NONBLOCK 0x0004 /* no delay */
#define O_APPEND 0x0008 /* set append mode */
#define O_SHLOCK 0x0010 /* open with shared file lock */
#define O_EXLOCK 0x0020 /* open with exclusive file lock */
#define O_ASYNC 0x0040 /* signal pgrp when data ready */
#define O_FSYNC 0x0080 /* synchronous writes */
#define O_CREAT 0x0200 /* create if nonexistant */
#define O_TRUNC 0x0400 /* truncate to zero length */
#define O_EXCL 0x0800 /* error if already exists */
/*
* Constants used for fcntl(2)
*/
/* command values */
#define F_DUPFD 0 /* duplicate file descriptor */
#define F_GETFD 1 /* get file descriptor flags */
#define F_SETFD 2 /* set file descriptor flags */
#define F_GETFL 3 /* get file status flags */
#define F_SETFL 4 /* set file status flags */
#define F_GETOWN 5 /* get SIGIO/SIGURG proc/pgrp */
#define F_SETOWN 6 /* set SIGIO/SIGURG proc/pgrp */
/* file descriptor flags (F_GETFD, F_SETFD) */
#define FD_CLOEXEC 1 /* close-on-exec flag */
/* lock operations for flock() */
#define LOCK_SH 1 /* shared file lock */
#define LOCK_EX 2 /* exclusive file lock */
#define LOCK_NB 4 /* don't block when locking */
#define LOCK_UN 8 /* unlock file */

77
include/smallc/signal.h Normal file
View File

@@ -0,0 +1,77 @@
/*
* Copyright (c) 1986 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*/
#ifndef NSIG
#define NSIG 32
#define SIGHUP 1 /* hangup */
#define SIGINT 2 /* interrupt */
#define SIGQUIT 3 /* quit */
#define SIGILL 4 /* illegal instruction (not reset when caught) */
#define SIGTRAP 5 /* trace trap (not reset when caught) */
#define SIGIOT 6 /* IOT instruction */
#define SIGABRT SIGIOT /* compatibility */
#define SIGEMT 7 /* EMT instruction */
#define SIGFPE 8 /* floating point exception */
#define SIGKILL 9 /* kill (cannot be caught or ignored) */
#define SIGBUS 10 /* bus error */
#define SIGSEGV 11 /* segmentation violation */
#define SIGSYS 12 /* bad argument to system call */
#define SIGPIPE 13 /* write on a pipe with no one to read it */
#define SIGALRM 14 /* alarm clock */
#define SIGTERM 15 /* software termination signal from kill */
#define SIGURG 16 /* urgent condition on IO channel */
#define SIGSTOP 17 /* sendable stop signal not from tty */
#define SIGTSTP 18 /* stop signal from tty */
#define SIGCONT 19 /* continue a stopped process */
#define SIGCHLD 20 /* to parent on child stop or exit */
#define SIGCLD SIGCHLD /* compatibility */
#define SIGTTIN 21 /* to readers pgrp upon background tty read */
#define SIGTTOU 22 /* like TTIN for output if (tp->t_local&LTOSTOP) */
#define SIGIO 23 /* input/output possible signal */
#define SIGXCPU 24 /* exceeded CPU time limit */
#define SIGXFSZ 25 /* exceeded file size limit */
#define SIGVTALRM 26 /* virtual time alarm */
#define SIGPROF 27 /* profiling time alarm */
#define SIGWINCH 28 /* window size changes */
#define SIGUSR1 30 /* user defined signal 1 */
#define SIGUSR2 31 /* user defined signal 2 */
#define SIG_ERR -1
#define SIG_DFL 0
#define SIG_IGN 1
#define BADSIG SIG_ERR
#define SA_ONSTACK 0x0001 /* take signal on signal stack */
#define SA_RESTART 0x0002 /* restart system on signal return */
#define SA_DISABLE 0x0004 /* disable taking signals on alternate stack */
#define SA_NOCLDSTOP 0x0008 /* do not generate SIGCHLD on child stop */
/*
* Flags for sigprocmask:
*/
#define SIG_BLOCK 1 /* block specified signal set */
#define SIG_UNBLOCK 2 /* unblock specified signal set */
#define SIG_SETMASK 3 /* set specified signal set */
#define MINSIGSTKSZ 128 /* minimum allowable stack */
#define SIGSTKSZ (MINSIGSTKSZ + 384) /* recommended stack size */
#define SV_ONSTACK SA_ONSTACK /* take signal on signal stack */
#define SV_INTERRUPT SA_RESTART /* same bit, opposite sense */
/*
* Macro for converting signal number to a mask suitable for
* sigblock().
*/
#define sigmask(m) (1L << ((m)-1))
#define sigaddset(set, signo) (*(set) |= 1L << ((signo) - 1), 0)
#define sigdelset(set, signo) (*(set) &= ~(1L << ((signo) - 1)), 0)
#define sigemptyset(set) (*(set) = (sigset_t)0, (int)0)
#define sigfillset(set) (*(set) = ~(sigset_t)0, (int)0)
#define sigismember(set, signo) ((*(set) & (1L << ((signo) - 1))) != 0)
#endif /* NSIG */

24
include/smallc/stdio.h Normal file
View File

@@ -0,0 +1,24 @@
/*
* SmallC: interface to stdio library.
*/
#define BUFSIZ 1024
#ifndef NULL
#define NULL 0
#endif
#define FILE int
#define EOF (-1)
extern int _iob[];
#define stdin (&_iob[0])
#define stdout (&_iob[5])
#define stderr (&_iob[10])
#define SEEK_SET 0 /* set file offset to offset */
#define SEEK_CUR 1 /* set file offset to current plus offset */
#define SEEK_END 2 /* set file offset to EOF plus offset */
#define getc fgetc
#define putc fputc

22
include/smallc/sys/gpio.h Normal file
View File

@@ -0,0 +1,22 @@
/*
* Ioctl definitions for GPIO driver.
*/
#define GPIO_PORT(n) (n) /* port number */
#define GPIO_PORTA 0
#define GPIO_PORTB 1
#define GPIO_PORTC 2
#define GPIO_PORTD 3
#define GPIO_PORTE 4
#define GPIO_PORTF 5
#define GPIO_PORTG 6
#define GPIO_CONFIN 0x20016700 /* configure as input */
#define GPIO_CONFOUT 0x20026700 /* configure as output */
#define GPIO_CONFOD 0x20046700 /* configure as open drain */
#define GPIO_DECONF 0x20086700 /* deconfigure */
#define GPIO_STORE 0x20106700 /* store all outputs */
#define GPIO_SET 0x20206700 /* set to 1 by mask */
#define GPIO_CLEAR 0x20406700 /* set to 0 by mask */
#define GPIO_INVERT 0x20806700 /* invert by mask */
#define GPIO_POLL 0x21006700 /* poll */
#define GPIO_LOL 0x82006700 /* display lol picture */

9
include/smallc/sys/spi.h Normal file
View File

@@ -0,0 +1,9 @@
/*
* Ioctl definitions for SPI driver.
*/
#define SPICTL_SETMODE 0x20007000 /* set SPI mode */
#define SPICTL_SETRATE 0x20007001 /* set clock rate, kHz */
#define SPICTL_SETSELPIN 0x20007002 /* set select pin */
#define SPICTL_IO8(n) (0xc0007003 | (n)<<16) /* transfer n*8 bits */
#define SPICTL_IO16(n) (0xc0007004 | (n)<<16) /* transfer n*16 bits */
#define SPICTL_IO32(n) (0xc0007005 | (n)<<16) /* transfer n*32 bits */

12
include/smallc/wiznet.h Normal file
View File

@@ -0,0 +1,12 @@
/*
* SmallC: interface to wiznet library.
*/
#define MAX_SOCK_NUM 4 /* Max number of sockets per chip */
#define CLIENT_SIZE 3 /* Size of client structure in words */
#define UDP_SIZE 2 /* Size of UDP structure in words */
extern unsigned _socket_port[];
extern unsigned _client_srcport;
extern unsigned _server_port;

42
include/stab.h Normal file
View File

@@ -0,0 +1,42 @@
/*
* Copyright (c) 1980 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
* @(#)stab.h 5.1 (Berkeley) 5/30/85
*/
/* IF YOU ADD DEFINITIONS, ADD THEM TO nm.c as well */
/*
* This file gives definitions supplementing <a.out.h>
* for permanent symbol table entries.
* These must have one of the N_STAB bits on,
* and are subject to relocation according to the masks in <a.out.h>.
*/
/*
* for symbolic debugger, sdb(1):
*/
#define N_GSYM 0x20 /* global symbol: name,,0,type,0 */
#define N_FNAME 0x22 /* procedure name (f77 kludge): name,,0 */
#define N_FUN 0x24 /* procedure: name,,0,linenumber,address */
#define N_STSYM 0x26 /* static symbol: name,,0,type,address */
#define N_LCSYM 0x28 /* .lcomm symbol: name,,0,type,address */
#define N_RSYM 0x40 /* register sym: name,,0,type,register */
#define N_SLINE 0x44 /* src line: 0,,0,linenumber,address */
#define N_SSYM 0x60 /* structure elt: name,,0,type,struct_offset */
#define N_SO 0x64 /* source file name: name,,0,0,address */
#define N_LSYM 0x80 /* local sym: name,,0,type,offset */
#define N_SOL 0x84 /* #included file name: name,,0,0,address */
#define N_PSYM 0xa0 /* parameter: name,,0,type,offset */
#define N_ENTRY 0xa4 /* alternate entry: name,linenumber,address */
#define N_LBRAC 0xc0 /* left bracket: 0,,0,nesting level,address */
#define N_RBRAC 0xe0 /* right bracket: 0,,0,nesting level,address */
#define N_BCOMM 0xe2 /* begin common: name,, */
#define N_ECOMM 0xe4 /* end common: name,, */
#define N_ECOML 0xe8 /* end common (local name): ,,address */
#define N_LENG 0xfe /* second stab entry with length information */
/*
* for the berkeley pascal compiler, pc(1):
*/
#define N_PC 0x30 /* global pascal symbol: name,,0,subtype,line */

35
include/stdarg.h Normal file
View File

@@ -0,0 +1,35 @@
/*
* ISO C Standard: 7.15 Variable arguments <stdarg.h>
*/
#ifndef _STDARG_H
#define _STDARG_H
/* Define __gnuc_va_list. */
#ifdef __GNUC__
# ifndef __GNUC_VA_LIST
# define __GNUC_VA_LIST
typedef __builtin_va_list __gnuc_va_list;
# endif
# define va_start(ap, last) __builtin_va_start((ap), last)
#endif
#ifdef __PCC__
# define va_start(ap, last) __builtin_stdarg_start((ap), last)
#endif
#define va_arg(ap, type) __builtin_va_arg((ap), type)
#define va_end(ap) __builtin_va_end((ap))
#define va_copy(dest, src) __builtin_va_copy((dest), (src))
#ifndef _VA_LIST_T
#define _VA_LIST_T
#ifdef __GNUC__
typedef __builtin_va_list va_list;
#endif
#ifdef __SMALLER_C__
typedef int *va_list;
#endif
#endif
#endif /* not _STDARG_H */

8
include/stddef.h Normal file
View File

@@ -0,0 +1,8 @@
/* Offset of member MEMBER in a struct of type TYPE. */
#if defined(__GNUC__) && __GNUC__ > 3
#define offsetof(TYPE, MEMBER) __builtin_offsetof (TYPE, MEMBER)
#else
#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE*)0)->MEMBER)
#endif

15
include/stdint.h Normal file
View File

@@ -0,0 +1,15 @@
#ifndef _STDINT_H
#define _STDINT_H
typedef signed char int8_t;
typedef short int int16_t;
typedef int int32_t;
typedef unsigned char uint8_t;
typedef unsigned short int uint16_t;
typedef unsigned int uint32_t;
#endif

134
include/stdio.h Normal file
View File

@@ -0,0 +1,134 @@
/*
* Copyright (c) 1980 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*/
#ifndef FILE
#include <sys/types.h>
#define BUFSIZ 1024
extern struct _iobuf {
int _cnt;
char *_ptr; /* should be unsigned char */
char *_base; /* ditto */
int _bufsiz;
short _flag;
short _file;
} _iob[];
#define _IOREAD 01
#define _IOWRT 02
#define _IONBF 04
#define _IOMYBUF 010
#define _IOEOF 020
#define _IOERR 040
#define _IOSTRG 0100
#define _IOLBF 0200
#define _IORW 0400
/*
* The following definition is for ANSI C, which took them
* from System V, which brilliantly took internal interface macros and
* made them official arguments to setvbuf(), without renaming them.
* Hence, these ugly _IOxxx names are *supposed* to appear in user code.
*/
#define _IOFBF 0 /* setvbuf should set fully buffered */
/* _IONBF and _IOLBF are used from the flags above */
#ifndef NULL
#define NULL 0
#endif
#define FILE struct _iobuf
#define EOF (-1)
#define stdin (&_iob[0])
#define stdout (&_iob[1])
#define stderr (&_iob[2])
#define SEEK_SET 0 /* set file offset to offset */
#define SEEK_CUR 1 /* set file offset to current plus offset */
#define SEEK_END 2 /* set file offset to EOF plus offset */
#ifndef lint
#define getc(p) (--(p)->_cnt>=0? (int)(*(unsigned char *)(p)->_ptr++):_filbuf(p))
#define putc(x, p) (--(p)->_cnt >= 0 ?\
(int)(*(unsigned char *)(p)->_ptr++ = (x)) :\
(((p)->_flag & _IOLBF) && -(p)->_cnt < (p)->_bufsiz ?\
((*(p)->_ptr = (x)) != '\n' ?\
(int)(*(unsigned char *)(p)->_ptr++) :\
_flsbuf(*(unsigned char *)(p)->_ptr, p)) :\
_flsbuf((unsigned char)(x), p)))
#endif /* not lint */
#define getchar() getc(stdin)
#define putchar(x) putc(x,stdout)
#define feof(p) (((p)->_flag&_IOEOF)!=0)
#define ferror(p) (((p)->_flag&_IOERR)!=0)
#define fileno(p) ((p)->_file)
#define clearerr(p) ((p)->_flag &= ~(_IOERR|_IOEOF))
FILE *fopen (const char *, const char *);
FILE *fdopen (int, const char *);
FILE *freopen (const char *, const char *, FILE *);
FILE *popen (const char *, const char *);
FILE *tmpfile (void);
int fclose (FILE *);
long ftell (FILE *);
int fflush (FILE *);
int fgetc (FILE *);
int ungetc (int, FILE *);
int fputc (int, FILE *);
int fputs (const char *, FILE *);
int puts (const char *);
char *fgets (char *, int, FILE *);
char *gets (char *);
FILE *_findiop (void);
int _filbuf (FILE *);
int _flsbuf (unsigned char, FILE *);
void setbuf (FILE *, char *);
void setbuffer (FILE *, char *, size_t);
void setlinebuf (FILE *);
int setvbuf (FILE *, char *, int, size_t);
int fseek (FILE *, long, int);
void rewind (FILE *);
int remove (const char *);
int getw(FILE *stream);
int putw(int w, FILE *stream);
size_t fread (void *, size_t, size_t, FILE *);
size_t fwrite (const void *, size_t, size_t, FILE *);
int fprintf (FILE *, const char *, ...);
int printf (const char *, ...);
int sprintf (char *, const char *, ...);
int snprintf (char *, size_t, const char *, ...);
int fscanf (FILE *, const char *, ...);
int scanf (const char *, ...);
int sscanf (const char *, const char *, ...);
#ifndef _VA_LIST_
#define va_list __builtin_va_list /* For GCC */
#endif
int vfprintf (FILE *, const char *, va_list);
int vprintf (const char *, va_list);
int vsprintf (char *, const char *, va_list);
int vsnprintf (char *, size_t, const char *, va_list);
int vfscanf (FILE *, const char *, va_list);
int vscanf (const char *, va_list);
int vsscanf (const char *, const char *, va_list);
int _doprnt (const char *, va_list, FILE *);
int _doscan (FILE *, const char *, va_list);
#ifndef _VA_LIST_
#undef va_list
#endif
void perror (const char *);
#endif /* _FILE */

102
include/stdlib.h Normal file
View File

@@ -0,0 +1,102 @@
/*-
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)stdlib.h 8.3.2 (2.11BSD) 1996/1/12
*
* Adapted from the 4.4-Lite CD. The odds of a ANSI C compiler for 2.11BSD
* being slipped under the door are not distinguishable from 0 - so the
* prototypes and ANSI ifdefs have been removed from this file.
*
* Some functions (strtoul for example) do not exist yet but are retained in
* this file because additions to libc.a are anticipated shortly.
*/
#ifndef _STDLIB_H_
#define _STDLIB_H_
#include <sys/types.h>
#ifndef NULL
#define NULL 0
#endif
#define EXIT_FAILURE 1
#define EXIT_SUCCESS 0
#define RAND_MAX 0x7fff
void abort();
int abs (int);
int atexit (void (*)(void));
double atof();
int atoi();
long atol();
void *calloc (size_t, size_t);
void exit (int);
void free (void *);
char *getenv();
long labs (long);
void *malloc (size_t);
char *mktemp (char *);
int mkstemp (char *);
void qsort();
int rand();
void *realloc (void*, size_t);
void srand();
double strtod();
long strtol();
unsigned long strtoul();
int system();
int putenv (char *string);
int setenv (const char *name, const char *value, int overwrite);
int unsetenv (const char *name);
char *_findenv (const char *name, int *offset);
void *alloca();
int daemon();
char *devname();
int getloadavg(unsigned loadavg[], int nelem);
extern char *suboptarg; /* getsubopt(3) external variable */
int getsubopt();
long random (void);
char *setstate (char *);
void srandom (unsigned);
char *ecvt (double, int, int *, int *);
char *fcvt (double, int, int *, int *);
char *gcvt (double, int, char *);
#endif /* _STDLIB_H_ */

43
include/string.h Normal file
View File

@@ -0,0 +1,43 @@
/*
* Copyright (c) 1985 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*/
#include <sys/types.h>
#ifndef NULL
#define NULL 0
#endif
char *strcat (char *, const char *);
char *strncat (char *, const char *, size_t);
char *strcpy (char *, const char *);
char *strncpy (char *, const char *, size_t);
char *strstr (const char *, const char *);
int strcmp (const char *, const char *);
int strncmp (const char *, const char *, size_t);
size_t strlen (const char *);
int memcmp (const void *, const void *, size_t);
void *memmove (void *, const void *, size_t);
void *memccpy (void *, const void *, int, size_t);
void *memchr (const void *, int, size_t);
void *memcpy (void *, const void *, size_t);
void *memset (void *, int, size_t);
char *strchr (const char *, int);
char *strdup (const char *);
char *strpbrk (const char *, const char *);
char *strrchr (const char *, int);
char *strsep (char **, const char *);
char *strtok (char *, const char *);
char *strtok_r (char *, const char *, char **);
size_t strcspn (const char *, const char *);
size_t strspn (const char *, const char *);
char *strerror (int);
const char *syserrlst (int);

42
include/strings.h Normal file
View File

@@ -0,0 +1,42 @@
/*-
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <sys/types.h>
int bcmp(const void *, const void *, size_t);
void bcopy(const void *, void *, size_t);
void bzero(void *, unsigned long);
int ffs(int);
char *index(const char *, int);
char *rindex(const char *, int);
int strcasecmp(const char *, const char *);
int strncasecmp(const char *, const char *, size_t);

9
include/struct.h Normal file
View File

@@ -0,0 +1,9 @@
/* struct.h 4.1 83/05/03 */
/*
* access to information relating to the fields of a structure
*/
#define fldoff(str, fld) ((int)&(((struct str *)0)->fld))
#define fldsiz(str, fld) (sizeof(((struct str *)0)->fld))
#define strbase(str, ptr, fld) ((struct str *)((char *)(ptr)-fldoff(str, fld)))

1
include/sys Symbolic link
View File

@@ -0,0 +1 @@
../sys/include

176
include/syscall.h Normal file
View File

@@ -0,0 +1,176 @@
/*
* Copyright (c) 1980 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*/
/*
* DO NOT place any comments on the same line as a SYS_* definition. This
* causes cpp to leave a trailing tab when expanding macros in pdp/sys/SYS.h
*/
#define SYS_exit 1
#define SYS_fork 2
#define SYS_read 3
#define SYS_write 4
#define SYS_open 5
#define SYS_close 6
#define SYS_wait4 7
/* 8 is old; creat */
#define SYS_link 9
#define SYS_unlink 10
#define SYS_execv 11
#define SYS_chdir 12
#define SYS_fchdir 13
#define SYS_mknod 14
#define SYS_chmod 15
#define SYS_chown 16
#define SYS_chflags 17
#define SYS_fchflags 18
#define SYS_lseek 19
#define SYS_getpid 20
#define SYS_mount 21
#define SYS_umount 22
#define SYS___sysctl 23
#define SYS_getuid 24
#define SYS_geteuid 25
#define SYS_ptrace 26
#define SYS_getppid 27
#define SYS_statfs 28
#define SYS_fstatfs 29
#define SYS_getfsstat 30
#define SYS_sigaction 31
#define SYS_sigprocmask 32
#define SYS_access 33
#define SYS_sigpending 34
#define SYS_sigaltstack 35
#define SYS_sync 36
#define SYS_kill 37
#define SYS_stat 38
/* 39 was getlogin */
#define SYS_lstat 40
#define SYS_dup 41
#define SYS_pipe 42
/* 43 was setlogin */
#define SYS_profil 44
#define SYS_setuid 45
#define SYS_seteuid 46
#define SYS_getgid 47
#define SYS_getegid 48
#define SYS_setgid 49
#define SYS_setegid 50
#define SYS_kmemdev 51
#define SYS_phys 52
#define SYS_lock 53
#define SYS_ioctl 54
#define SYS_reboot 55
#define SYS_sigwait 56
#define SYS_symlink 57
#define SYS_readlink 58
#define SYS_execve 59
#define SYS_umask 60
#define SYS_chroot 61
#define SYS_fstat 62
/* 63 is unused */
/* 64 is old; getpagesize */
#define SYS_pselect 65
#define SYS_vfork 2 /* 66 - not fixed yet */
/* 67 is old; vread */
/* 68 is old; vwrite */
#define SYS_sbrk 69
#define SYS_rdglob 70
#define SYS_wrglob 71
/* 71 is unused 4.3: mmap */
#define SYS_msec 72 /* 72 is unused 4.3: vadvise */
/* 73 is unused 4.3: munmap */
/* 74 is unused 4.3: mprotect */
/* 75 is unused 4.3: madvise */
#define SYS_vhangup 76
/* 77 is old; vlimit */
/* 78 is unused 4.3: mincore */
#define SYS_getgroups 79
#define SYS_setgroups 80
#define SYS_getpgrp 81
#define SYS_setpgrp 82
#define SYS_setitimer 83
/* 84 is old; wait,wait3 */
#define SYS_swapon 85
#define SYS_getitimer 86
/* 87 is old; gethostname */
/* 88 is old; sethostname */
#define SYS_getdtablesize 89
#define SYS_dup2 90
/* 91 is unused 4.3: getdopt */
#define SYS_fcntl 92
#define SYS_select 93
/* 94 is unused 4.3: setdopt */
#define SYS_fsync 95
#define SYS_setpriority 96
#define SYS_socket 97
#define SYS_connect 98
#define SYS_accept 99
#define SYS_getpriority 100
#define SYS_send 101
#define SYS_recv 102
#define SYS_sigreturn 103
#define SYS_bind 104
#define SYS_setsockopt 105
#define SYS_listen 106
#define SYS_sigsuspend 107
/*
* 108 thru 112 are 4.3BSD compatibility syscalls. sigstack has to remain
* defined because no replacement routine exists. Sigh.
*/
/* 108 is old; sigvec */
/* 109 is old; sigblock */
/* 110 is old; sigsetmask */
/* 111 is old; sigpause */
#define SYS_sigstack 112
#define SYS_recvmsg 113
#define SYS_sendmsg 114
/* 115 is old; vtrace */
#define SYS_gettimeofday 116
#define SYS_getrusage 117
#define SYS_getsockopt 118
/* 119 is old; resuba */
#define SYS_readv 120
#define SYS_writev 121
#define SYS_settimeofday 122
#define SYS_fchown 123
#define SYS_fchmod 124
#define SYS_recvfrom 125
/* 126 is old; setreuid */
/* 127 is old; setregid */
#define SYS_rename 128
#define SYS_truncate 129
#define SYS_ftruncate 130
#define SYS_flock 131
/* 132 is unused */
#define SYS_sendto 133
#define SYS_shutdown 134
#define SYS_socketpair 135
#define SYS_mkdir 136
#define SYS_rmdir 137
#define SYS_utimes 138
/* 139 is unused */
#define SYS_adjtime 140
#define SYS_getpeername 141
/* 142 is old; gethostid */
/* 143 is old; sethostid */
#define SYS_getrlimit 144
#define SYS_setrlimit 145
#define SYS_killpg 146
/* 147 is unused */
#define SYS_setquota 148
#define SYS_quota 149
#define SYS_getsockname 150
/*
* 2BSD special calls
*/
/* 151 is unused */
#define SYS_ustore 152
#define SYS_ufetch 153
#define SYS_ucall 154
/* 155 is unused */

97
include/sysexits.h Normal file
View File

@@ -0,0 +1,97 @@
/*
* Copyright (c) 1987 Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms are permitted
* provided that this notice is preserved and that due credit is given
* to the University of California at Berkeley. The name of the University
* may not be used to endorse or promote products derived from this
* software without specific prior written permission. This software
* is provided ``as is'' without express or implied warranty.
*
* @(#)sysexits.h 4.4.1 (2.11BSD) 1996/11/29
*/
/*
** SYSEXITS.H -- Exit status codes for system programs.
**
** This include file attempts to categorize possible error
** exit statuses for system programs, notably delivermail
** and the Berkeley network.
**
** Error numbers begin at EX__BASE to reduce the possibility of
** clashing with other exit statuses that random programs may
** already return. The meaning of the codes is approximately
** as follows:
**
** EX_USAGE -- The command was used incorrectly, e.g., with
** the wrong number of arguments, a bad flag, a bad
** syntax in a parameter, or whatever.
** EX_DATAERR -- The input data was incorrect in some way.
** This should only be used for user's data & not
** system files.
** EX_NOINPUT -- An input file (not a system file) did not
** exist or was not readable. This could also include
** errors like "No message" to a mailer (if it cared
** to catch it).
** EX_NOUSER -- The user specified did not exist. This might
** be used for mail addresses or remote logins.
** EX_NOHOST -- The host specified did not exist. This is used
** in mail addresses or network requests.
** EX_UNAVAILABLE -- A service is unavailable. This can occur
** if a support program or file does not exist. This
** can also be used as a catchall message when something
** you wanted to do doesn't work, but you don't know
** why.
** EX_SOFTWARE -- An internal software error has been detected.
** This should be limited to non-operating system related
** errors as possible.
** EX_OSERR -- An operating system error has been detected.
** This is intended to be used for such things as "cannot
** fork", "cannot create pipe", or the like. It includes
** things like getuid returning a user that does not
** exist in the passwd file.
** EX_OSFILE -- Some system file (e.g., /etc/passwd, /var/run/utmp,
** etc.) does not exist, cannot be opened, or has some
** sort of error (e.g., syntax error).
** EX_CANTCREAT -- A (user specified) output file cannot be
** created.
** EX_IOERR -- An error occurred while doing I/O on some file.
** EX_TEMPFAIL -- temporary failure, indicating something that
** is not really an error. In sendmail, this means
** that a mailer (e.g.) could not create a connection,
** and the request should be reattempted later.
** EX_PROTOCOL -- the remote system returned something that
** was "not possible" during a protocol exchange.
** EX_NOPERM -- You did not have sufficient permission to
** perform the operation. This is not intended for
** file system problems, which should use NOINPUT or
** CANTCREAT, but rather for higher level permissions.
** For example, kre uses this to restrict who students
** can send mail to.
**
** Maintained by Eric Allman (eric@berkeley, ucbvax!eric) --
** please mail changes to me.
**
** @(#)sysexits.h 4.4 3/24/88
*/
# define EX_OK 0 /* successful termination */
# define EX__BASE 64 /* base value for error messages */
# define EX_USAGE 64 /* command line usage error */
# define EX_DATAERR 65 /* data format error */
# define EX_NOINPUT 66 /* cannot open input */
# define EX_NOUSER 67 /* addressee unknown */
# define EX_NOHOST 68 /* host name unknown */
# define EX_UNAVAILABLE 69 /* service unavailable */
# define EX_SOFTWARE 70 /* internal software error */
# define EX_OSERR 71 /* system error (e.g., can't fork) */
# define EX_OSFILE 72 /* critical OS file missing */
# define EX_CANTCREAT 73 /* can't create (user) output file */
# define EX_IOERR 74 /* input/output error */
# define EX_TEMPFAIL 75 /* temp failure; user is invited to retry */
# define EX_PROTOCOL 76 /* remote error in protocol */
# define EX_NOPERM 77 /* permission denied */
# define EX_CONFIG 78 /* configuration error */

1
include/syslog.h Symbolic link
View File

@@ -0,0 +1 @@
sys/syslog.h

242
include/tcl/tcl.h Normal file
View File

@@ -0,0 +1,242 @@
/*
* tcl.h --
*
* This header file describes the externally-visible facilities
* of the Tcl interpreter.
*
* Copyright 1987-1991 Regents of the University of California
* Permission to use, copy, modify, and distribute this
* software and its documentation for any purpose and without
* fee is hereby granted, provided that the above copyright
* notice appear in all copies. The University of California
* makes no representations about the suitability of this
* software for any purpose. It is provided "as is" without
* express or implied warranty.
*/
#ifndef _TCL
#define _TCL
#define TCL_VERSION "6.7"
#define TCL_MAJOR_VERSION 6
#define TCL_MINOR_VERSION 7
/*
* Data structures defined opaquely in this module. The definitions
* below just provide dummy types. A few fields are made visible in
* Tcl_Interp structures, namely those for returning string values.
* Note: any change to the Tcl_Interp definition below must be mirrored
* in the "real" definition in tclInt.h.
*/
typedef struct Tcl_Interp {
unsigned char *result; /* Points to result string returned by last
* command. */
void (*freeProc) (unsigned char *blockPtr);
/* Zero means result is statically allocated.
* If non-zero, gives address of procedure
* to invoke to free the result. Must be
* freed by Tcl_Eval before executing next
* command. */
unsigned short errorLine; /* When TCL_ERROR is returned, this gives
* the line number within the command where
* the error occurred (1 means first line). */
} Tcl_Interp;
typedef void *Tcl_Trace;
typedef void *Tcl_CmdBuf;
/*
* When a TCL command returns, the string pointer interp->result points to
* a string containing return information from the command. In addition,
* the command procedure returns an integer value, which is one of the
* following:
*
* TCL_OK Command completed normally; interp->result contains
* the command's result.
* TCL_ERROR The command couldn't be completed successfully;
* interp->result describes what went wrong.
* TCL_RETURN The command requests that the current procedure
* return; interp->result contains the procedure's
* return value.
* TCL_BREAK The command requests that the innermost loop
* be exited; interp->result is meaningless.
* TCL_CONTINUE Go on to the next iteration of the current loop;
* interp->result is meaninless.
*/
#define TCL_OK 0
#define TCL_ERROR 1
#define TCL_RETURN 2
#define TCL_BREAK 3
#define TCL_CONTINUE 4
#define TCL_RESULT_SIZE 199
/*
* Procedure types defined by Tcl:
*/
typedef void (Tcl_CmdDeleteProc) (void *clientData);
typedef int (Tcl_CmdProc) (void *clientData,
Tcl_Interp *interp, int argc, unsigned char *argv[]);
typedef void (Tcl_CmdTraceProc) (void *clientData,
Tcl_Interp *interp, int level, unsigned char *command, Tcl_CmdProc *proc,
void *cmdClientData, int argc, unsigned char *argv[]);
typedef void (Tcl_FreeProc) (unsigned char *blockPtr);
typedef unsigned char *(Tcl_VarTraceProc) (void *clientData,
Tcl_Interp *interp, unsigned char *part1, unsigned char *part2, int flags);
/*
* Flag values passed to Tcl_Eval (see the man page for details; also
* see tclInt.h for additional flags that are only used internally by
* Tcl):
*/
#define TCL_BRACKET_TERM 1
/*
* Flag that may be passed to Tcl_ConvertElement to force it not to
* output braces (careful! if you change this flag be sure to change
* the definitions at the front of tclUtil.c).
*/
#define TCL_DONT_USE_BRACES 1
/*
* Flag value passed to Tcl_RecordAndEval to request no evaluation
* (record only).
*/
#define TCL_NO_EVAL -1
/*
* Specil freeProc values that may be passed to Tcl_SetResult (see
* the man page for details):
*/
#define TCL_STATIC ((Tcl_FreeProc *) 0)
#define TCL_VOLATILE ((Tcl_FreeProc *) -1)
#define TCL_DYNAMIC ((Tcl_FreeProc *) -2)
/*
* Flag values passed to variable-related procedures.
*/
#define TCL_GLOBAL_ONLY 1
#define TCL_APPEND_VALUE 2
#define TCL_LIST_ELEMENT 4
#define TCL_NO_SPACE 8
#define TCL_TRACE_READS 0x10
#define TCL_TRACE_WRITES 0x20
#define TCL_TRACE_UNSETS 0x40
#define TCL_TRACE_DESTROYED 0x80
#define TCL_INTERP_DESTROYED 0x100
#define TCL_LEAVE_ERR_MSG 0x200
/*
* Additional flag passed back to variable watchers. This flag must
* not overlap any of the TCL_TRACE_* flags defined above or the
* TRACE_* flags defined in tclInt.h.
*/
#define TCL_VARIABLE_UNDEFINED 8
/*
* Exported Tcl procedures:
*/
extern void Tcl_AppendElement (Tcl_Interp *interp, unsigned char *string,
int noSep);
extern void Tcl_AppendResult (Tcl_Interp *interp, ...);
extern unsigned char * Tcl_AssembleCmd (Tcl_CmdBuf buffer, unsigned char *string);
extern void Tcl_AddErrorInfo (Tcl_Interp *interp, unsigned char *message);
extern char Tcl_Backslash (unsigned char *src, int *readPtr);
extern int Tcl_CommandComplete (unsigned char *cmd);
extern unsigned char * Tcl_Concat (int argc, unsigned char **argv);
extern int Tcl_ConvertElement (unsigned char *src, unsigned char *dst, int flags);
extern Tcl_CmdBuf Tcl_CreateCmdBuf (void);
extern void Tcl_CreateCommand (Tcl_Interp *interp, unsigned char *cmdName,
Tcl_CmdProc *proc, void *clientData,
Tcl_CmdDeleteProc *deleteProc);
extern Tcl_Interp * Tcl_CreateInterp (void);
extern int Tcl_CreatePipeline (Tcl_Interp *interp, int argc,
unsigned char **argv, int **pidArrayPtr,
int *inPipePtr, int *outPipePtr,
int *errFilePtr);
extern Tcl_Trace Tcl_CreateTrace (Tcl_Interp *interp,
int level, Tcl_CmdTraceProc *proc,
void *clientData);
extern void Tcl_DeleteCmdBuf (Tcl_CmdBuf buffer);
extern int Tcl_DeleteCommand (Tcl_Interp *interp,
unsigned char *cmdName);
extern void Tcl_DeleteInterp (Tcl_Interp *interp);
extern void Tcl_DeleteTrace (Tcl_Interp *interp,
Tcl_Trace trace);
extern void Tcl_DetachPids (int numPids, int *pidPtr);
extern unsigned char * Tcl_ErrnoId (void);
extern int Tcl_Eval (Tcl_Interp *interp, unsigned char *cmd,
int flags, unsigned char **termPtr);
extern int Tcl_EvalFile (Tcl_Interp *interp,
unsigned char *fileName);
extern int Tcl_ExprBoolean (Tcl_Interp *interp, unsigned char *string,
int *ptr);
extern int Tcl_ExprLong (Tcl_Interp *interp, unsigned char *string,
long *ptr);
extern int Tcl_ExprString (Tcl_Interp *interp, unsigned char *string);
extern int Tcl_Fork (void);
extern void Tcl_FreeResult (Tcl_Interp *interp);
extern int Tcl_GetBoolean (Tcl_Interp *interp,
unsigned char *string, int *boolPtr);
extern int Tcl_GetInt (Tcl_Interp *interp,
unsigned char *string, int *intPtr);
extern unsigned char * Tcl_GetVar (Tcl_Interp *interp,
unsigned char *varName, int flags);
extern unsigned char * Tcl_GetVar2 (Tcl_Interp *interp,
unsigned char *part1, unsigned char *part2, int flags);
extern int Tcl_GlobalEval (Tcl_Interp *interp,
unsigned char *command);
extern void Tcl_InitHistory (Tcl_Interp *interp);
extern void Tcl_InitMemory (Tcl_Interp *interp);
extern unsigned char * Tcl_Merge (int argc, unsigned char **argv);
extern unsigned char * Tcl_ParseVar (Tcl_Interp *interp,
unsigned char *string, unsigned char **termPtr);
extern int Tcl_RecordAndEval (Tcl_Interp *interp,
unsigned char *cmd, int flags);
extern void Tcl_ResetResult (Tcl_Interp *interp);
extern int Tcl_ScanElement (unsigned char *string,
int *flagPtr);
extern void Tcl_SetErrorCode (Tcl_Interp *interp, ...);
extern void Tcl_SetResult (Tcl_Interp *interp,
unsigned char *string, Tcl_FreeProc *freeProc);
extern unsigned char * Tcl_SetVar (Tcl_Interp *interp,
unsigned char *varName, unsigned char *newValue, int flags);
extern unsigned char * Tcl_SetVar2 (Tcl_Interp *interp,
unsigned char *part1, unsigned char *part2,
unsigned char *newValue, int flags);
extern unsigned char * Tcl_SignalId (int sig);
extern unsigned char * Tcl_SignalMsg (int sig);
extern int Tcl_SplitList (Tcl_Interp *interp,
unsigned char *list, int *argcPtr, unsigned char ***argvPtr);
extern int Tcl_StringMatch (unsigned char *string,
unsigned char *pattern);
extern unsigned char * Tcl_TildeSubst (Tcl_Interp *interp,
unsigned char *name);
extern int Tcl_TraceVar (Tcl_Interp *interp,
unsigned char *varName, int flags, Tcl_VarTraceProc *proc,
void *clientData);
extern int Tcl_TraceVar2 (Tcl_Interp *interp,
unsigned char *part1, unsigned char *part2, int flags,
Tcl_VarTraceProc *proc, void *clientData);
extern int Tcl_UnsetVar (Tcl_Interp *interp,
unsigned char *varName, int flags);
extern int Tcl_UnsetVar2 (Tcl_Interp *interp,
unsigned char *part1, unsigned char *part2, int flags);
extern void Tcl_UntraceVar (Tcl_Interp *interp,
unsigned char *varName, int flags, Tcl_VarTraceProc *proc,
void *clientData);
extern void Tcl_UntraceVar2 (Tcl_Interp *interp,
unsigned char *part1, unsigned char *part2, int flags,
Tcl_VarTraceProc *proc, void *clientData);
extern int Tcl_VarEval (Tcl_Interp *interp, ...);
extern void * Tcl_VarTraceInfo (Tcl_Interp *interp,
unsigned char *varName, int flags,
Tcl_VarTraceProc *procPtr,
void *prevClientData);
extern void * Tcl_VarTraceInfo2 (Tcl_Interp *interp,
unsigned char *part1, unsigned char *part2, int flags,
Tcl_VarTraceProc *procPtr,
void *prevClientData);
extern int Tcl_WaitPids (int numPids, int *pidPtr,
int *statusPtr);
#endif /* _TCL */

11
include/term.h Normal file
View File

@@ -0,0 +1,11 @@
#ifndef _TERM_H
#define _TERM_H
extern int tgetent(char *, char *);
extern int tgetnum(char *);
extern int tgetflag(char *);
extern char *tgetstr(char *, char **);
extern char *tgoto(char *, int, int);
extern int tputs(register char *, int, int (*)());
#endif

149
include/termios-todo.h Normal file
View File

@@ -0,0 +1,149 @@
#ifndef _TERMIOS_H
#define _TERMIOS_H
#include <sys/ioctl.h>
#include <stdint.h>
#define E_TERMCAP "/etc/termcap"
typedef unsigned char cc_t;
typedef unsigned int speed_t;
typedef unsigned int tcflag_t;
#define NCCS 32
struct termios
{
tcflag_t c_iflag; /* input mode flags */
tcflag_t c_oflag; /* output mode flags */
tcflag_t c_cflag; /* control mode flags */
tcflag_t c_lflag; /* local mode flags */
cc_t c_line; /* line discipline */
cc_t c_cc[NCCS]; /* control characters */
speed_t c_ispeed; /* input speed */
speed_t c_ospeed; /* output speed */
#define _HAVE_STRUCT_TERMIOS_C_ISPEED 1
#define _HAVE_STRUCT_TERMIOS_C_OSPEED 1
};
extern int tcgetattr(int, struct termios *);
extern int tcsetattr(int, int, struct termios *);
/* c_cc characters */
#define VINTR 0
#define VQUIT 1
#define VERASE 2
#define VKILL 3
#define VEOF 4
#define VTIME 5
#define VMIN 6
#define VSWTC 7
#define VSTART 8
#define VSTOP 9
#define VSUSP 10
#define VEOL 11
#define VREPRINT 12
#define VDISCARD 13
#define VWERASE 14
#define VLNEXT 15
#define VEOL2 16
/* c_iflag bits */
#define IGNBRK 0000001
#define BRKINT 0000002
#define IGNPAR 0000004
#define PARMRK 0000010
#define INPCK 0000020
#define ISTRIP 0000040
#define INLCR 0000100
#define IGNCR 0000200
#define ICRNL 0000400
#define IUCLC 0001000
#define IXON 0002000
#define IXANY 0004000
#define IXOFF 0010000
#define IMAXBEL 0020000
#define IUTF8 0040000
/* c_oflag bits */
#define OPOST 0000001
#define OLCUC 0000002
#define ONLCR 0000004
#define OCRNL 0000010
#define ONOCR 0000020
#define ONLRET 0000040
#define OFILL 0000100
#define OFDEL 0000200
#if defined __USE_MISC || defined __USE_XOPEN
# define NLDLY 0000400
# define NL0 0000000
# define NL1 0000400
# define CRDLY 0003000
# define CR0 0000000
# define CR1 0001000
# define CR2 0002000
# define CR3 0003000
# define TABDLY 0014000
# define TAB0 0000000
# define TAB1 0004000
# define TAB2 0010000
# define TAB3 0014000
# define BSDLY 0020000
# define BS0 0000000
# define BS1 0020000
# define FFDLY 0100000
# define FF0 0000000
# define FF1 0100000
#endif
#define VTDLY 0040000
#define VT0 0000000
#define VT1 0040000
#ifdef __USE_MISC
# define XTABS 0014000
#endif
/* c_lflag bits */
#define ISIG 0000001
#define ICANON 0000002
#define CSIZE 0000060
#define CS5 0000000
#define CS6 0000020
#define CS7 0000040
#define CS8 0000060
#define CSTOPB 0000100
#define CREAD 0000200
#define PARENB 0000400
#define PARODD 0001000
#define HUPCL 0002000
#define CLOCAL 0004000
#define IEXTEN 0100000
/* tcflow() and TCXONC use these */
#define TCOOFF 0
#define TCOON 1
#define TCIOFF 2
#define TCION 3
/* tcflush() and TCFLSH use these */
#define TCIFLUSH 0
#define TCOFLUSH 1
#define TCIOFLUSH 2
/* tcsetattr uses these */
#define TCSANOW 0
#define TCSADRAIN 1
#define TCSAFLUSH 2
#define TCSASOFT 0x10
#define CIGNORE 0x00000001
#define TIOCGETA _IOR(i, 92, struct termios)
#define TIOCSETA _IOW(i, 92, struct termios)
#define TIOCSETAW _IOW(i, 92, struct termios)
#define TIOCSETAF _IOW(i, 92, struct termios)
#endif

35
include/time.h Normal file
View File

@@ -0,0 +1,35 @@
/*
* Copyright (c) 1983, 1987 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*/
#ifndef _TIME_H
#define _TIME_H
#include <sys/types.h> /* for time_t */
/*
* Structure returned by gmtime and localtime calls (see ctime(3)).
*/
struct tm {
int tm_sec;
int tm_min;
int tm_hour;
int tm_mday;
int tm_mon;
int tm_year;
int tm_wday;
int tm_yday;
int tm_isdst;
long tm_gmtoff;
char *tm_zone;
};
extern struct tm *gmtime(), *localtime();
extern char *asctime(), *ctime();
extern time_t time();
size_t strftime (char *s, size_t maxsize, const char *format,
const struct tm *timeptr);
#endif

22
include/ttyent.h Normal file
View File

@@ -0,0 +1,22 @@
/*
* Copyright (c) 1983 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*/
struct ttyent { /* see getttyent(3) */
char *ty_name; /* terminal device name */
char *ty_getty; /* command to execute, usually getty */
char *ty_type; /* terminal type for termcap (3X) */
int ty_status; /* status flags (see below for defines) */
char *ty_window; /* command to start up window manager */
char *ty_comment; /* usually the location of the terminal */
};
#define TTY_ON 0x1 /* enable logins (startup getty) */
#define TTY_SECURE 0x2 /* allow root to login */
struct ttyent *getttyent (void);
struct ttyent *getttynam (const char *name);
void setttyent (void);
void endttyent (void);

100
include/tzfile.h Normal file
View File

@@ -0,0 +1,100 @@
/*
* @(#)tzfile.h 5.2.1 (2.11BSD) 1996/11/29
*/
/*
** Information about time zone files.
*/
/* Time zone object file directory */
#define TZDEFAULT "/etc/localtime"
/*
** Each file begins with. . .
*/
struct tzhead {
char tzh_reserved[32]; /* reserved for future use */
char tzh_timecnt[4]; /* coded number of transition times */
char tzh_typecnt[4]; /* coded number of local time types */
char tzh_charcnt[4]; /* coded number of abbr. chars */
};
/*
** . . .followed by. . .
**
** tzh_timecnt (char [4])s coded transition times a la time(2)
** tzh_timecnt (unsigned char)s types of local time starting at above
** tzh_typecnt repetitions of
** one (char [4]) coded GMT offset in seconds
** one (unsigned char) used to set tm_isdt
** one (unsigned char) that's an abbreviation list index
** tzh_charcnt (char)s '\0'-terminated zone abbreviaton strings
*/
/*
** In the current implementation, "tzset()" refuses to deal with files that
** exceed any of the limits below.
*/
/*
** The TZ_MAX_TIMES value below is enough to handle a bit more than a
** year's worth of solar time (corrected daily to the nearest second) or
** 138 years of Pacific Presidential Election time
** (where there are three time zone transitions every fourth year).
*/
#define TZ_MAX_TIMES 370
#define NOSOLAR /* We currently don't handle solar time */
#ifndef NOSOLAR
#define TZ_MAX_TYPES 256 /* Limited by what (unsigned char)'s can hold */
#else /* !NOSOLAR */
#define TZ_MAX_TYPES 10 /* Maximum number of local time types */
#endif /* !NOSOLAR */
#define TZ_MAX_CHARS 50 /* Maximum number of abbreviation characters */
#define SECS_PER_MIN 60
#define MINS_PER_HOUR 60
#define HOURS_PER_DAY 24
#define DAYS_PER_WEEK 7
#define DAYS_PER_NYEAR 365
#define DAYS_PER_LYEAR 366
#define SECS_PER_HOUR (SECS_PER_MIN * MINS_PER_HOUR)
#define SECS_PER_DAY ((long) SECS_PER_HOUR * HOURS_PER_DAY)
#define MONS_PER_YEAR 12
#define TM_SUNDAY 0
#define TM_MONDAY 1
#define TM_TUESDAY 2
#define TM_WEDNESDAY 3
#define TM_THURSDAY 4
#define TM_FRIDAY 5
#define TM_SATURDAY 6
#define TM_JANUARY 0
#define TM_FEBRUARY 1
#define TM_MARCH 2
#define TM_APRIL 3
#define TM_MAY 4
#define TM_JUNE 5
#define TM_JULY 6
#define TM_AUGUST 7
#define TM_SEPTEMBER 8
#define TM_OCTOBER 9
#define TM_NOVEMBER 10
#define TM_DECEMBER 11
#define TM_SUNDAY 0
#define TM_YEAR_BASE 1900
#define EPOCH_YEAR 1970
#define EPOCH_WDAY TM_THURSDAY
/*
** Accurate only for the past couple of centuries;
** that will probably do.
*/
#define isleap(y) ((((y) % 4) == 0 && ((y) % 100) != 0) || ((y) % 400) == 0)

161
include/unistd.h Normal file
View File

@@ -0,0 +1,161 @@
/*-
* Copyright (c) 1991, 1993, 1994
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
/*
* Modified for 2.11BSD by removing prototypes. To save time and space
* functions not returning 'int' and functions not present in the system
* are not listed.
*/
#ifndef _UNISTD_H_
#define _UNISTD_H_
#include <sys/types.h>
#define STDIN_FILENO 0 /* standard input file descriptor */
#define STDOUT_FILENO 1 /* standard output file descriptor */
#define STDERR_FILENO 2 /* standard error file descriptor */
#ifndef NULL
#define NULL 0 /* null pointer constant */
#endif
/* Values for the second argument to access.
These may be OR'd together. */
#define R_OK 4 /* Test for read permission. */
#define W_OK 2 /* Test for write permission. */
#define X_OK 1 /* Test for execute permission. */
#define F_OK 0 /* Test for existence. */
void _exit (int);
int access();
unsigned int alarm();
pid_t fork();
gid_t getegid();
uid_t geteuid();
gid_t getgid();
char *getlogin();
pid_t getpgrp();
pid_t getpid();
pid_t getppid();
uid_t getuid();
off_t lseek();
ssize_t read();
unsigned int sleep();
char *ttyname();
ssize_t write (int fd, const void *buf, size_t count);
int truncate (const char *path, off_t length);
int ftruncate (int fd, off_t length);
void *brk (const void *addr);
int _brk (const void *addr);
char *crypt();
void endusershell();
long gethostid();
char *getpass();
char *getusershell();
char *getwd();
void psignal();
extern char *sys_siglist[];
char *re_comp();
void *sbrk (int incr);
int sethostid();
void setusershell();
void sync();
unsigned int ualarm();
void usleep();
int pause (void);
pid_t vfork();
int pipe (int pipefd[2]);
int close (int fd);
int dup (int oldfd);
int dup2 (int oldfd, int newfd);
int unlink (const char *pathname);
int link (const char *oldpath, const char *newpath);
ssize_t readlink (const char *path, char *buf, size_t bufsiz);
int chown (const char *path, uid_t owner, gid_t group);
int nice (int inc);
int setuid (uid_t uid);
int setgid (gid_t gid);
int seteuid (uid_t euid);
int setegid (gid_t egid);
int setreuid (uid_t ruid, uid_t euid);
int setregid (gid_t rgid, gid_t egid);
int isatty (int fd);
int chdir (const char *path);
int fchdir (int fd);
int chflags (const char *path, u_long flags);
int fchflags (int fd, u_long flags);
int getgroups (int size, gid_t list[]);
int getdtablesize (void);
int rmdir (const char *pathname);
struct stat;
int stat (const char *path, struct stat *buf);
int fstat (int fd, struct stat *buf);
int lstat (const char *path, struct stat *buf);
int execl (const char *path, const char *arg0, ... /* NULL */);
int execle (const char *path, const char *arg0, ... /* NULL, char *envp[] */);
int execlp (const char *file, const char *arg0, ... /* NULL */);
int execv (const char *path, char *const argv[]);
int execve (const char *path, char *const arg0[], char *const envp[]);
int execvp (const char *file, char *const argv[]);
extern char **environ; /* Environment, from crt0. */
extern const char *__progname; /* Program name, from crt0. */
int getopt (int argc, char * const argv[], const char *optstring);
extern char *optarg; /* getopt(3) external variables */
extern int opterr, optind, optopt;
#ifndef _VA_LIST_
#define va_list __builtin_va_list /* For GCC */
#endif
void err (int eval, const char *fmt, ...);
void errx (int eval, const char *fmt, ...);
void warn (const char *fmt, ...);
void warnx (const char *fmt, ...);
void verr (int eval, const char *fmt, va_list ap);
void verrx (int eval, const char *fmt, va_list ap);
void vwarn (const char *fmt, va_list ap);
void vwarnx (const char *fmt, va_list ap);
#ifndef _VA_LIST_
#undef va_list
#endif
#endif /* !_UNISTD_H_ */

27
include/utmp.h Normal file
View File

@@ -0,0 +1,27 @@
/*
* Copyright (c) 1988 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms are permitted
* provided that the above copyright notice and this paragraph are
* duplicated in all such forms and that any documentation,
* advertising materials, and other materials related to such
* distribution and use acknowledge that the software was developed
* by the University of California, Berkeley. The name of the
* University may not be used to endorse or promote products derived
* from this software without specific prior written permission.
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
#define UT_NAMESIZE 15
#define UT_LINESIZE 8
#define UT_HOSTSIZE 16
struct utmp {
char ut_line[UT_LINESIZE];
char ut_name[UT_NAMESIZE];
char ut_host[UT_HOSTSIZE];
long ut_time;
};

64
include/vmf.h Normal file
View File

@@ -0,0 +1,64 @@
/* Program Name: vmf.h
* Author: S.M. Schultz
*
* ----------- Modification History ------------
* Version Date Reason For Modification
* 1.0 01Jan80 1. Initial release.
* 2.0 31Mar83 2. Cleanup.
* 3.0 08Sep93 3. Change v_foffset to off_t instead of int.
* 3.1 21Oct93 4. Create union member of structure to
* make 'int' or 'char' access to data easy.
* Define segment+offset and modified macros.
* Place into the public domain.
* --------------------------------------------------
*/
#include <sys/types.h>
#define MAXSEGNO 16384 /* max number of segments in a space */
#define BYTESPERSEG 1024 /* must be power of two! */
#define LOG2BPS 10 /* log2(BYTESPERSEG) */
#define WORDSPERSEG (BYTESPERSEG/sizeof (int))
struct vspace {
int v_fd; /* file for swapping */
off_t v_foffset; /* offset for computing file addresses */
int v_maxsegno; /* number of segments in this space */
};
struct dlink { /* general double link structure */
struct dlink *fwd; /* forward link */
struct dlink *back; /* back link */
};
struct vseg { /* structure of a segment in memory */
struct dlink s_link; /* for linking into lru list */
int s_segno; /* segment number */
struct vspace *s_vspace; /* which virtual space */
int s_lock_count;
int s_flags;
union
{
int _winfo[WORDSPERSEG]; /* the actual segment */
char _cinfo[BYTESPERSEG];
} v_un;
};
#define s_winfo v_un._winfo
#define s_cinfo v_un._cinfo
/* masks for s_flags */
#define S_DIRTY 01 /* segment has been modified */
long nswaps; /* number of swaps */
long nmapsegs; /* number of mapseg calls */
int vminit(), vmopen();
struct vseg *vmmapseg();
void vmlock(), vmunlock(), vmclrseg(), vmmodify();
void vmflush(), vmclose();
typedef long VADDR;
#define VMMODIFY(seg) (seg->s_flags |= S_DIRTY)
#define VSEG(va) ((short)(va >> LOG2BPS))
#define VOFF(va) ((u_short)va % BYTESPERSEG)

29
include/wiznet/client.h Normal file
View File

@@ -0,0 +1,29 @@
#ifndef client_h
#define client_h
struct _client_t {
unsigned sock;
uint8_t *ip;
unsigned port;
};
typedef struct _client_t client_t;
extern unsigned _client_srcport;
void client_init (client_t *c, uint8_t *ip, unsigned port);
void client_init_sock (client_t *c, unsigned sock);
unsigned client_status (client_t *);
int client_connect (client_t *);
void client_putc (client_t *, uint8_t);
void client_puts (client_t *c, const char *str);
void client_write (client_t *c, const uint8_t *buf, unsigned size);
int client_available (client_t *);
int client_getc (client_t *);
int client_read (client_t *c, uint8_t *buf, unsigned size);
int client_peek (client_t *);
void client_flush (client_t *);
void client_stop (client_t *);
int client_connected (client_t *);
#endif

12
include/wiznet/ethernet.h Normal file
View File

@@ -0,0 +1,12 @@
#ifndef ethernet_h
#define ethernet_h
#include <stdint.h>
#include "client.h"
#include "server.h"
#define MAX_SOCK_NUM 4
void ethernet_init (void);
#endif

16
include/wiznet/server.h Normal file
View File

@@ -0,0 +1,16 @@
#ifndef server_h
#define server_h
#include "client.h"
extern unsigned _server_port;
void server_init (unsigned port);
int server_available (client_t *);
void server_accept (void);
void server_putc (uint8_t byte);
void server_puts (const char *str);
void server_write (const uint8_t *buf, unsigned size);
#endif

56
include/wiznet/socket.h Normal file
View File

@@ -0,0 +1,56 @@
#ifndef _SOCKET_H_
#define _SOCKET_H_
#include "w5100.h"
extern unsigned _socket_port [MAX_SOCK_NUM];
/*
* Opens a socket(TCP or UDP or IP_RAW mode)
*/
unsigned socket_init (unsigned sock, unsigned protocol, unsigned port, unsigned flag);
/*
* Close socket
*/
void socket_close (unsigned sock);
/*
* Establish TCP connection (Active connection)
*/
unsigned socket_connect (unsigned sock, uint8_t *addr, unsigned port);
/*
* disconnect the connection
*/
void socket_disconnect (unsigned sock);
/*
* Establish TCP connection (Passive connection)
*/
unsigned socket_listen (unsigned sock);
/*
* Send data (TCP)
*/
unsigned socket_send (unsigned sock, const uint8_t *buf, unsigned len);
/*
* Receive data (TCP)
*/
unsigned socket_recv (unsigned sock, uint8_t *buf, unsigned len);
unsigned socket_peek (unsigned sock);
/*
* Send data (UDP/IP RAW)
*/
unsigned socket_sendto (unsigned sock, const uint8_t *buf, unsigned len, uint8_t *addr, unsigned port);
/*
* Receive data (UDP/IP RAW)
*/
unsigned socket_recvfrom (unsigned sock, uint8_t *buf, unsigned len, uint8_t *addr, unsigned *port);
unsigned socket_igmpsend (unsigned sock, const uint8_t *buf, unsigned len);
#endif /* _SOCKET_H_ */

79
include/wiznet/udp.h Normal file
View File

@@ -0,0 +1,79 @@
/*
* Udp.cpp: Library to send/receive UDP packets with the Arduino ethernet shield.
* This version only offers minimal wrapping of socket.c/socket.h
*
* NOTE: UDP is fast, but has some important limitations (thanks to Warren Gray for mentioning these)
* 1) UDP does not guarantee the order in which assembled UDP packets are received. This
* might not happen often in practice, but in larger network topologies, a UDP
* packet can be received out of sequence.
* 2) UDP does not guard against lost packets - so packets *can* disappear without the sender being
* aware of it. Again, this may not be a concern in practice on small local networks.
* For more information, see http://www.cafeaulait.org/course/week12/35.html
*
* MIT License:
* Copyright (c) 2008 Bjoern Hartmann
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* bjoern@cs.stanford.edu 12/30/2008
*/
#ifndef udp_h
#define udp_h
#define UDP_TX_PACKET_MAX_SIZE 24
struct _udp_t {
unsigned port; // local port to listen on
unsigned sock; // socket ID for Wiz5100
};
typedef struct _udp_t udp_t;
/*
* Initialize, start listening on specified port.
* Returns 1 if successful, 0 if there are no sockets available to use.
*/
int udp_init (udp_t *u, unsigned port);
/*
* Has data been received?
*/
unsigned udp_available (udp_t *u);
/*
* Finish with the UDP socket.
*/
void udp_stop (udp_t *u);
/*
* Send a packet to specified peer.
*/
unsigned udp_send_packet (udp_t *u, const uint8_t *data, unsigned len,
uint8_t *ip, unsigned port);
/*
* Send a zero-terminated string to specified peer.
*/
unsigned udp_send_string (udp_t *u, const char *data,
uint8_t *ip, unsigned port);
/*
* Read a received packet, also return sender's ip and port.
*/
int udp_read_packet (udp_t *u, uint8_t *buf, unsigned len, uint8_t *ip, unsigned *port);
#endif

262
include/wiznet/w5100.h Normal file
View File

@@ -0,0 +1,262 @@
/*
* Copyright (c) 2010 by Cristian Maglie <c.maglie@bug.st>
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of either the GNU General Public License version 2
* or the GNU Lesser General Public License version 2.1, both as
* published by the Free Software Foundation.
*
* Updated August/3/2011 by Lowell Scott Hanson to be compatable with chipKIT boards
* Updated April/13/2012 by Serge Vakulenko for RetroBSD project
*/
#ifndef W5100_H_INCLUDED
#define W5100_H_INCLUDED
#include <stdint.h>
#define MAX_SOCK_NUM 4
/*
* Common Mode Register.
*/
#define MR_IND 0x01 /* Indirect bus interface mode */
#define MR_AI 0x02 /* Address auto-increment for indirect mode */
#define MR_PPPoE 0x08 /* PPPoE mode */
#define MR_PB 0x10 /* Ping block mode */
#define MR_RST 0x80 /* Software reset */
/*
* Socket Mode Register.
*/
#define SnMR_CLOSE 0x00
#define SnMR_TCP 0x01
#define SnMR_UDP 0x02
#define SnMR_IPRAW 0x03
#define SnMR_MACRAW 0x04
#define SnMR_PPPOE 0x05
#define SnMR_ND 0x20 /* No delayed ACK */
#define SnMR_MULTI 0x80 /* Enable multicasting */
/*
* Socket Command Register.
*/
#define Sock_OPEN 0x01
#define Sock_LISTEN 0x02
#define Sock_CONNECT 0x04
#define Sock_DISCON 0x08
#define Sock_CLOSE 0x10
#define Sock_SEND 0x20
#define Sock_SEND_MAC 0x21
#define Sock_SEND_KEEP 0x22
#define Sock_RECV 0x40
/*
* Socket Interrupt Register.
*/
#define SnIR_SEND_OK 0x10
#define SnIR_TIMEOUT 0x08
#define SnIR_RECV 0x04
#define SnIR_DISCON 0x02
#define SnIR_CON 0x01
/*
* Socket Status Register.
*/
#define SnSR_CLOSED 0x00
#define SnSR_INIT 0x13
#define SnSR_LISTEN 0x14
#define SnSR_SYNSENT 0x15
#define SnSR_SYNRECV 0x16
#define SnSR_ESTABLISHED 0x17
#define SnSR_FIN_WAIT 0x18
#define SnSR_CLOSING 0x1A
#define SnSR_TIME_WAIT 0x1B
#define SnSR_CLOSE_WAIT 0x1C
#define SnSR_LAST_ACK 0x1D
#define SnSR_UDP 0x22
#define SnSR_IPRAW 0x32
#define SnSR_MACRAW 0x42
#define SnSR_PPPOE 0x5F
#define TXBUF_SIZE 2048 // Max Tx buffer size
#define RXBUF_SIZE 2048 // Max Rx buffer size
#define CH_BASE 0x0400
#define CH_SIZE 0x0100
/*----------------------------------------------
* W5100 Registers
*/
unsigned w5100_write_byte (unsigned addr, int byte);
unsigned w5100_write (unsigned addr, const uint8_t *buf, unsigned len);
unsigned w5100_read_byte (unsigned addr);
unsigned w5100_read (unsigned addr, uint8_t *buf, unsigned len);
#define __GP_REGISTER8(name, address) \
static inline void w5100_write##name (unsigned data) { \
w5100_write_byte (address, data); \
} \
static inline unsigned w5100_read##name() { \
return w5100_read_byte (address); \
}
#define __GP_REGISTER16(name, address) \
static inline void w5100_write##name(unsigned data) { \
w5100_write_byte (address, data >> 8); \
w5100_write_byte (address+1, data & 0xFF); \
} \
static inline unsigned w5100_read##name() { \
unsigned res = w5100_read_byte (address); \
res = (res << 8) + w5100_read_byte (address + 1); \
return res; \
}
#define __GP_REGISTER_N(name, address, size) \
static inline unsigned w5100_write##name(uint8_t *buff) { \
return w5100_write(address, buff, size); \
} \
static inline unsigned w5100_read##name(uint8_t *buff) { \
return w5100_read(address, buff, size); \
}
__GP_REGISTER8 (MR, 0x0000); // Mode
__GP_REGISTER_N(GAR, 0x0001, 4); // Gateway IP address
__GP_REGISTER_N(SUBR, 0x0005, 4); // Subnet mask address
__GP_REGISTER_N(SHAR, 0x0009, 6); // Source MAC address
__GP_REGISTER_N(SIPR, 0x000F, 4); // Source IP address
__GP_REGISTER8 (IR, 0x0015); // Interrupt
__GP_REGISTER8 (IMR, 0x0016); // Interrupt Mask
__GP_REGISTER16(RTR, 0x0017); // Timeout address
__GP_REGISTER8 (RCR, 0x0019); // Retry count
__GP_REGISTER8 (RMSR, 0x001A); // Receive memory size
__GP_REGISTER8 (TMSR, 0x001B); // Transmit memory size
__GP_REGISTER8 (PATR, 0x001C); // Authentication type address in PPPoE mode
__GP_REGISTER8 (PTIMER, 0x0028); // PPP LCP Request Timer
__GP_REGISTER8 (PMAGIC, 0x0029); // PPP LCP Magic Number
__GP_REGISTER_N(UIPR, 0x002A, 4); // Unreachable IP address in UDP mode
__GP_REGISTER16(UPORT, 0x002E); // Unreachable Port address in UDP mode
#undef __GP_REGISTER8
#undef __GP_REGISTER16
#undef __GP_REGISTER_N
/*----------------------------------------------
* W5100 Socket registers
*/
static inline unsigned
w5100_readSn_byte (unsigned sock, unsigned addr)
{
return w5100_read_byte (CH_BASE + sock*CH_SIZE + addr);
}
static inline unsigned
w5100_writeSn_byte (unsigned sock, unsigned addr, unsigned data)
{
return w5100_write_byte (CH_BASE + sock*CH_SIZE + addr, data);
}
static inline unsigned
w5100_readSn (unsigned sock, unsigned addr, uint8_t *buf, unsigned len)
{
return w5100_read (CH_BASE + sock*CH_SIZE + addr, buf, len);
}
static inline unsigned
w5100_writeSn (unsigned sock, unsigned addr, uint8_t *buf, unsigned len)
{
return w5100_write (CH_BASE + sock*CH_SIZE + addr, buf, len);
}
#define __SOCKET_REGISTER8(name, address) \
static inline void w5100_write##name (unsigned sock, unsigned data) { \
w5100_writeSn_byte (sock, address, data); \
} \
static inline unsigned w5100_read##name (unsigned sock) { \
return w5100_readSn_byte (sock, address); \
}
#define __SOCKET_REGISTER16(name, address) \
static inline void w5100_write##name (unsigned sock, unsigned data) { \
w5100_writeSn_byte (sock, address, data >> 8); \
w5100_writeSn_byte (sock, address+1, data & 0xFF); \
} \
static inline unsigned w5100_read##name (unsigned sock) { \
unsigned res = w5100_readSn_byte (sock, address); \
res = (res << 8) + w5100_readSn_byte (sock, address + 1); \
return res; \
}
#define __SOCKET_REGISTER_N(name, address, size) \
static inline unsigned w5100_write##name (unsigned sock, uint8_t *buf) { \
return w5100_writeSn (sock, address, buf, size); \
} \
static inline unsigned read##name (unsigned sock, uint8_t *buf) { \
return w5100_readSn (sock, address, buf, size); \
}
__SOCKET_REGISTER8(SnMR, 0x0000) // Mode
__SOCKET_REGISTER8(SnCR, 0x0001) // Command
__SOCKET_REGISTER8(SnIR, 0x0002) // Interrupt
__SOCKET_REGISTER8(SnSR, 0x0003) // Status
__SOCKET_REGISTER16(SnPORT, 0x0004) // Source Port
__SOCKET_REGISTER_N(SnDHAR, 0x0006, 6) // Destination Hardw Addr
__SOCKET_REGISTER_N(SnDIPR, 0x000C, 4) // Destination IP Addr
__SOCKET_REGISTER16(SnDPORT, 0x0010) // Destination Port
__SOCKET_REGISTER16(SnMSSR, 0x0012) // Max Segment Size
__SOCKET_REGISTER8(SnPROTO, 0x0014) // Protocol in IP RAW Mode
__SOCKET_REGISTER8(SnTOS, 0x0015) // IP TOS
__SOCKET_REGISTER8(SnTTL, 0x0016) // IP TTL
__SOCKET_REGISTER16(SnTX_FSR, 0x0020) // TX Free Size
__SOCKET_REGISTER16(SnTX_RD, 0x0022) // TX Read Pointer
__SOCKET_REGISTER16(SnTX_WR, 0x0024) // TX Write Pointer
__SOCKET_REGISTER16(SnRX_RSR, 0x0026) // RX Free Size
__SOCKET_REGISTER16(SnRX_RD, 0x0028) // RX Read Pointer
__SOCKET_REGISTER16(SnRX_WR, 0x002A) // RX Write Pointer (supported?)
#undef __SOCKET_REGISTER8
#undef __SOCKET_REGISTER16
#undef __SOCKET_REGISTER_N
/*----------------------------------------------
* W5100 functions
*/
void w5100_init();
/*
* This function is being used for copy the data form Receive buffer
* of the chip to application buffer.
*
* It calculate the actual physical address where one has to read
* the data from Receive buffer. Here also take care of the condition
* while it exceed the Rx memory uper-bound of socket.
*/
void w5100_read_data (unsigned sock, unsigned src, uint8_t *dst, unsigned len);
/*
* This function is being called by send() and sendto() function also.
*
* This function read the Tx write pointer register and after copy the data
* in buffer update the Tx write pointer register.
*/
void w5100_send_chunk (unsigned sock, const uint8_t *data, unsigned len);
/*
* This function is being called by recv() also.
*
* This function read the Rx read pointer register and after copy
* the data from receive buffer update the Rx write pointer register.
*/
void w5100_recv_chunk (unsigned sock, uint8_t *data, unsigned len);
unsigned w5100_recv_peek (unsigned sock);
void w5100_socket_cmd (unsigned sock, int cmd);
unsigned w5100_getTXFreeSize (unsigned sock);
unsigned w5100_getRXReceivedSize (unsigned sock);
/*
* Debug output.
*/
//#define W5100_DEBUG printf
#ifndef W5100_DEBUG
# define W5100_DEBUG(...) /* empty */
#endif
#endif

65
lib/Makefile Normal file
View File

@@ -0,0 +1,65 @@
TOPSRC = $(shell cd ..; pwd)
SUBDIR = startup libc libcurses libtermlib libwiznet
PROG = ar as aout ld nm ranlib size strip
# Build a list of the host include directories.
CPP = $(shell gcc -print-prog-name=cc1)
HOSTINC = $(addprefix -I,$(shell echo | $(CPP) -v 2>&1 | grep '^ /.*include'))
# Add system include path
ifeq (,$(wildcard /usr/include/i386-linux-gnu))
HOSTINC += -I/usr/include
else
HOSTINC += -I/usr/include/i386-linux-gnu
endif
CFLAGS += -nostdinc -fno-builtin -g -Werror -Wall -DCROSS -I. $(HOSTINC) \
-I$(TOPSRC)/include -I$(TOPSRC)/src/cmd/ar \
-I$(TOPSRC)/src/cmd/as
LDFLAGS += -g
AR_OBJS = ar.o append.o archive.o contents.o delete.o extract.o \
misc.o move.o print.o replace.o strmode.o
AOUT_OBJS = aout.o mips-dis.o
RANLIB_OBJS = ranlib.o archive.o
HEADERS = a.out.h ar.h nlist.h ranlib.h
vpath %.c $(TOPSRC)/src/cmd/ar $(TOPSRC)/src/cmd/as $(TOPSRC)/src/cmd/ld \
$(TOPSRC)/src/cmd/nm $(TOPSRC)/src/cmd/ranlib $(TOPSRC)/src/cmd
all install depend: $(HEADERS) $(SUBDIR) $(PROG)
-for i in $(SUBDIR); do $(MAKE) -C $$i $(MFLAGS) DESTDIR=$(DESTDIR) $@; done
clean:
rm -f *~ *.o *.a *.h $(PROG) retroImage gccdump.s
for i in $(SUBDIR); do $(MAKE) -C $$i $(MFLAGS) clean; done
ar: $(AR_OBJS)
$(CC) $(LDFLAGS) -o $@ $(AR_OBJS) $(LIBS)
as: as.o
$(CC) $(LDFLAGS) -o $@ $< $(LIBS)
aout: $(AOUT_OBJS)
$(CC) $(LDFLAGS) -o $@ $(AOUT_OBJS) $(LIBS)
ld: ld.o
$(CC) $(LDFLAGS) -o $@ $< $(LIBS)
nm: nm.o
$(CC) $(LDFLAGS) -o $@ $< $(LIBS)
ranlib: $(RANLIB_OBJS)
$(CC) $(LDFLAGS) -o $@ $(RANLIB_OBJS) $(LIBS)
size: size.o
$(CC) $(LDFLAGS) -o $@ $< $(LIBS)
strip: strip.o
$(CC) $(LDFLAGS) -o $@ $< $(LIBS)
$(HEADERS):
-ln -s -f ../include/a.out.h .
-ln -s -f ../include/ar.h .
-ln -s -f ../include/nlist.h .
-ln -s -f ../include/ranlib.h .

111
lib/libc/Makefile Normal file
View File

@@ -0,0 +1,111 @@
TOPSRC = $(shell cd ../..; pwd)
include $(TOPSRC)/target.mk
LIBCDIR = $(TOPSRC)/src/libc
vpath %.S $(LIBCDIR)/mips/sys $(LIBCDIR)/mips/string $(LIBCDIR)/mips/gen \
$(LIBCDIR)/runtime
vpath %.c $(LIBCDIR)/mips/sys $(LIBCDIR)/gen $(LIBCDIR)/stdio \
$(LIBCDIR)/stdlib $(LIBCDIR)/string $(LIBCDIR)/inet \
$(LIBCDIR)/compat $(LIBCDIR)/runtime
CFLAGS += -B$(TOPSRC)/lib/ $(DEFS) -Wa,-x -Wall -Werror
ASFLAGS += -B$(TOPSRC)/lib/ $(DEFS) -Wa,-x -I$(LIBCDIR)/mips/sys
# modules which can not use SYSCALL and must be assembled from sources. The
# rest of the system calls are generated with printf(1) and do not have
# source files associated with them.
# libc/mips/sys
SYSOBJS = __sysctl.o accept.o access.o adjtime.o bind.o chdir.o \
chflags.o chmod.o chown.o chroot.o close.o connect.o dup.o \
dup2.o execve.o fchdir.o fchflags.o fchmod.o fchown.o \
fcntl.o flock.o fork.o fstat.o fsync.o ftruncate.o \
getdtablesize.o getgroups.o getitimer.o getsockname.o \
getpeername.o getpriority.o getrlimit.o getrusage.o \
getsockopt.o gettimeofday.o ioctl.o kill.o killpg.o link.o \
listen.o lstat.o mkdir.o mknod.o mount.o open.o pselect.o \
quota.o read.o readlink.o readv.o reboot.o recv.o \
recvfrom.o recvmsg.o rename.o rmdir.o select.o send.o \
sendmsg.o sendto.o setgroups.o setitimer.o setpgrp.o \
setpriority.o setquota.o setuid.o seteuid.o setgid.o \
setegid.o setrlimit.o setsockopt.o settimeofday.o \
shutdown.o sigaltstack.o socket.o socketpair.o stat.o \
symlink.o sigprocmask.o sigstack.o sigwait.o statfs.o \
fstatfs.o getfsstat.o truncate.o umount.o unlink.o \
utimes.o wait4.o write.o writev.o lseek.o sigsuspend.o \
getgid.o getegid.o getpgrp.o getpid.o getppid.o getuid.o \
geteuid.o profil.o sigpending.o sync.o ufetch.o ustore.o \
ucall.o umask.o vfork.o vhangup.o rdglob.o wrglob.o
OBJS = $(SYSOBJS) sbrk.o execl.o execle.o execv.o \
_exit.o _brk.o pipe.o ptrace.o sigaction.o
# libc/mips/string
ASFLAGS += -DLWHI=lwr -DLWLO=lwl -DSWHI=swr -DSWLO=swl
OBJS += bcopy.o bzero.o ffs.o memcpy.o memmove.o memset.o \
strlen.o bcmp.o index.o rindex.o strcmp.o
# libc/mips/gen
OBJS += _setjmp.o htonl.o htons.o
# libc/gen
OBJS += abort.o alarm.o atof.o atoi.o atol.o calloc.o closedir.o crypt.o \
ctime.o ctype_.o daemon.o devname.o ecvt.o err.o \
execvp.o fakcu.o frexp.o fstab.o gcvt.o getenv.o getgrent.o \
getgrgid.o getgrnam.o getlogin.o \
getgrouplist.o gethostname.o getpagesize.o \
getpass.o getpwent.o getloadavg.o getmntinfo.o \
getttyent.o getttynam.o getusershell.o getwd.o \
initgroups.o isatty.o isinff.o isnanf.o ldexp.o malloc.o mktemp.o \
modff.o ndbm.o nlist.o knlist.o opendir.o perror.o popen.o \
psignal.o qsort.o random.o readdir.o regex.o scandir.o \
seekdir.o setmode.o sethostname.o setenv.o siglist.o \
signal.o siginterrupt.o sigsetops.o \
sleep.o strcasecmp.o strftime.o swab.o sysctl.o syslog.o system.o \
strcat.o strncat.o strcpy.o strncpy.o strncmp.o \
telldir.o time.o timezone.o ttyname.o ttyslot.o ualarm.o usleep.o \
strdup.o uname.o wait.o wait3.o waitpid.o
# libc/stdio
OBJS += fgetc.o fgets.o fputc.o fputs.o gets.o puts.o \
clrerr.o doscan.o exit.o fdopen.o filbuf.o findiop.o \
flsbuf.o fopen.o fprintf.o fread.o freopen.o fseek.o \
ftell.o fwrite.o getchar.o getw.o printf.o putchar.o putw.o \
rew.o scanf.o setbuf.o setbuffer.o setvbuf.o snprintf.o sprintf.o \
strout.o ungetc.o vfprintf.o vprintf.o vsprintf.o doprnt.o \
remove.o feof.o ferror.o fileno.o
# libc/stdlib
OBJS += getopt.o getsubopt.o strtol.o strtoul.o strtod.o
# libc/string
OBJS += strcspn.o strpbrk.o strerror.o strsep.o strspn.o \
strstr.o strtok.o strtok_r.o
# libc/inet
OBJS += inet_addr.o inet_network.o inet_netof.o \
inet_ntoa.o inet_lnaof.o inet_maddr.o
# libc/compat
OBJS += creat.o ftime.o gethostid.o gtty.o memccpy.o memchr.o \
memcmp.o memcpy.o memset.o nice.o pause.o rand.o \
sethostid.o setregid.o setreuid.o setrgid.o setruid.o \
sigcompat.o strchr.o strrchr.o stty.o times.o tmpnam.o \
utime.o
# libc/runtime
OBJS += addsf3.o comparesf2.o divsf3.o fixsfsi.o floatsisf.o \
mulsf3.o negsf2.o subsf3.o sc_case.o
all: ../libc.a
../libc.a: ../ar ../ranlib $(OBJS)
../ar rc $@ $(OBJS)
../ranlib $@
$(SYSOBJS): $(LIBCDIR)/mips/sys/SYS.h
@echo creating $*.o
@printf '#include "SYS.h"\nSYS($*)\n' | $(AS) $(ASFLAGS) - -c -o $*.o
clean:
rm -f *~ *.o a.out *.a

22
lib/libcurses/Makefile Normal file
View File

@@ -0,0 +1,22 @@
TOPSRC = $(shell cd ../..; pwd)
include $(TOPSRC)/target.mk
vpath %.c $(TOPSRC)/src/libcurses
CFLAGS += -B$(TOPSRC)/lib/ $(DEFS) -Wa,-x -Wall -Werror
OBJS = addch.o addstr.o box.o clear.o clrtobot.o clrtoeol.o cr_put.o \
cr_tty.o curses.o delch.o deleteln.o delwin.o endwin.o erase.o \
fullname.o getch.o getstr.o idlok.o id_subwins.o initscr.o insch.o \
insertln.o longname.o move.o mvprintw.o mvscanw.o mvwin.o newwin.o \
overlay.o overwrite.o printw.o putchar.o refresh.o scanw.o scroll.o \
toucholap.o standout.o touchwin.o tstp.o unctrl.o
all: ../libcurses.a
../libcurses.a: ../ar ../ranlib $(OBJS)
../ar rc $@ $(OBJS)
../ranlib $@
clean:
rm -f *~ *.o a.out *.a

17
lib/libtermlib/Makefile Normal file
View File

@@ -0,0 +1,17 @@
TOPSRC = $(shell cd ../..; pwd)
include $(TOPSRC)/target.mk
vpath %.c $(TOPSRC)/src/libtermlib
CFLAGS += -B$(TOPSRC)/lib/ $(DEFS) -Wa,-x -Wall -Werror
OBJS = termcap.o tgoto.o tputs.o tcattr.o
all: ../libtermlib.a
../libtermlib.a: ../ar ../ranlib $(OBJS)
../ar rc $@ $(OBJS)
../ranlib $@
clean:
rm -f *~ *.o a.out *.a

17
lib/libwiznet/Makefile Normal file
View File

@@ -0,0 +1,17 @@
TOPSRC = $(shell cd ../..; pwd)
include $(TOPSRC)/target.mk
vpath %.c $(TOPSRC)/src/libwiznet
CFLAGS += -B$(TOPSRC)/lib/ $(DEFS) -Wa,-x -Wall -Werror
OBJS = w5100.o socket.o ethernet.o client.o server.o udp.o
all: ../libwiznet.a
../libwiznet.a: ../ar ../ranlib $(OBJS)
../ar rc $@ $(OBJS)
../ranlib $@
clean:
rm -f *~ *.o a.out *.a

22
lib/startup/Makefile Normal file
View File

@@ -0,0 +1,22 @@
#
# Copyright (c) 1987 Regents of the University of California.
# All rights reserved. The Berkeley software License Agreement
# specifies the terms and conditions for redistribution.
#
# crt0 Normal C run time startoff
#
TOPSRC = $(shell cd ../..; pwd)
include $(TOPSRC)/target.mk
vpath %.c $(TOPSRC)/src/startup-mips
CFLAGS = -B$(TOPSRC)/lib/ -O -Wa,-x $(DEFS)
OBJS = ../crt0.o
all: $(OBJS)
../crt0.o: crt0.c
$(CC) $(DEFS) $(CFLAGS) -c $< -o $@
clean:
rm -f $(OBJS) *~

14
share/example/Makefile Normal file
View File

@@ -0,0 +1,14 @@
all: ashello echo
ashello: ashello.o
$(LD) ashello.o -o $@
chello: chello.o
$(CC) chello.o -o $@
echo: echo.o
$(LD) $@.o -o $@
clean:
rm -f *.o ashello echo *.dis *~

View File

@@ -0,0 +1,30 @@
TOPSRC = $(shell cd ../..; pwd)
include $(TOPSRC)/target.mk
CFLAGS += -Werror
ASFLAGS += -DCROSS
ASLDFLAGS = --oformat=elf32-tradlittlemips -N -nostartfiles -T $(TOPSRC)/src/elf32-mips.ld
all: hello cplus
hello: hello.o
${CC} ${LDFLAGS} -o hello.elf hello.o ${LIBS}
${OBJDUMP} -S hello.elf > hello.dis
${SIZE} hello.elf
${ELF2AOUT} hello.elf $@
cplus: cplus.o
${CXX} ${LDFLAGS} -nostdlib -o cplus.elf cplus.o ${LIBS}
${OBJDUMP} -S cplus.elf > cplus.dis
${SIZE} cplus.elf
${ELF2AOUT} cplus.elf $@
echo: echo.o
${LD} ${ASLDFLAGS} -o $@.elf $@.o
${OBJDUMP} -S $@.elf > $@.dis
${SIZE} $@.elf
${ELF2AOUT} $@.elf $@
./aout $@ > $@.dis
clean:
rm -f *.o *.elf ${MAN} hello cplus *.elf *.dis tags *~

25
share/example/ashello.S Normal file
View File

@@ -0,0 +1,25 @@
/*
* This is an example of MIPS assembly program for RetroBSD.
*
* To compile this program, type:
* cc -c ashello.S
* ld ashello.o -o ashello
*/
#include <syscall.h>
.data // begin data segment
hello: .ascii "Hello, assembly world!\n" // a string
.text // begin code segment
.globl start // entry point for ld
start:
li $a0, 0 // arg 1: stdout fd
la $a1, hello // arg 2: string address
li $a2, 23 // arg 3: string length
syscall SYS_write // call the kernel: write()
nop // returns here on error
nop // skips two words on success
li $a0, 0 // arg 1: exit status
syscall SYS_exit // call the kernel: exit()
// no return

61
share/example/blkjack.bas Normal file
View File

@@ -0,0 +1,61 @@
10 rem **************************************
20 rem *** Play the "blackjack" (21) game ***
30 rem **************************************
40 dim C(52): m = 1000
50 rem
60 rem Create deck of cards and shuffle it
70 rem
80 for i=0 to 51: c(i) = i: next i
90 for i=0 to 51: i1=rnd(52): i2=c(i): c(i)=c(i2): c(i2)=i1: next i
100 rem
110 rem Prompt for amount of bet (on this game)
120 rem
130 print "You have", m, " dollars"
140 input "How much do you wish to bet?", b: if b=0 then stop
150 lif b>m then print "You don't have enough money":goto 140
160 t = 0: d = 0
170 rem
180 rem Prompt PLAYER for another card
190 rem
200 print "Total:", t,:Input " Another card (Y/N)?", a$
210 if a$="n" then 380
220 lif a$<>"y" then print "Please answer y-Yes or n-No":goto 200
230 c = c(d): d = d + 1: gosub 530
240 c = c % 13: if c > 9 then c = 9
250 if c > 0 then 300
260 input "(1)one or (t)ten ?", a$
270 if a$="1" then 300
280 if a$<>"t" then 260
290 c = 9
300 t = t + c + 1
310 if t <= 21 then 200
320 print "You went over 21! - you LOSE!"
330 m = m - b: if m > 0 then 80
340 print "You went BUST!":end
350 rem
360 rem Play DEALER
370 rem
380 t1 = 0
390 c = c(d): d = d + 1: print "Dealer draws ",: gosub 530
400 c = c % 13: if c > 9 then c = 9
410 if c > 0 then 470
420 if t1 < 10 then 450
430 if (t1+10) > 23 then 460
440 if (t1+10) >= t then 450
450 c = 9
460 print "Dealer chooses", c+1
470 t1 = t1 + c + 1: print "Dealer totals", t1: if t1 < t then 390
480 lif t1 <= 21 then print "Dealer wins - You LOSE!": goto 330
490 print "Dealer loses - You WIN!!!": m = m + b: goto 80
500 rem
510 rem Subroutine to display text description of a card
520 rem
530 order 590
540 for a = 0 to c / 13: read a$: next a
550 order 600
560 for a = 0 to c % 13: read a1$:next a
570 print a1$, " of ", a$
580 return
590 data "Hearts", "Diamonds", "Clubs", "Spades"
600 data "Ace", "Two", "Three", "Four", "Five", "Six", "Seven"
610 data "Eight", "Nine", "Ten", "Jack", "Queen", "King"

Some files were not shown because too many files have changed in this diff Show More