aboutsummaryrefslogtreecommitdiffstats
path: root/sdk/std
diff options
context:
space:
mode:
Diffstat (limited to 'sdk/std')
-rw-r--r--sdk/std/Makefile.in18
-rw-r--r--sdk/std/bind.conf69
-rw-r--r--sdk/std/files.h47
-rw-r--r--sdk/std/help.conf4
-rw-r--r--sdk/std/limits.h97
-rw-r--r--sdk/std/make.conf102
-rw-r--r--sdk/std/math.h31
-rw-r--r--sdk/std/poll.h21
-rw-r--r--sdk/std/posix1_lim.h92
-rw-r--r--sdk/std/process.h99
-rw-r--r--sdk/std/select.h21
-rw-r--r--sdk/std/signal.h11
-rw-r--r--sdk/std/string.c110
-rw-r--r--sdk/std/string.h75
-rw-r--r--sdk/std/sysexits.h118
-rw-r--r--sdk/std/time.h23
-rw-r--r--sdk/std/types.h54
-rw-r--r--sdk/std/utmp.c49
-rw-r--r--sdk/std/utmp.h31
19 files changed, 1072 insertions, 0 deletions
diff --git a/sdk/std/Makefile.in b/sdk/std/Makefile.in
new file mode 100644
index 0000000..d8f600b
--- /dev/null
+++ b/sdk/std/Makefile.in
@@ -0,0 +1,18 @@
+#
+# Template to build standard sdk object modules(libstd.a)
+# $Id: Makefile.in 1.2 Wed, 19 Mar 1997 12:44:53 -0500 dyfet $
+# Copyright (c) 1997 by Tycho Softworks.
+#
+
+OBJS = string.o utmp.o
+
+.c.o:
+ $(CC) $(CFLAGS) $(OPTIMIZE) -I.. -o $@ -c $<
+ $(AR) r ../lib/libstd.a $@
+
+all: $(OBJS)
+ ranlib ../lib/libstd.a
+
+clean:
+ rm *.o
+
diff --git a/sdk/std/bind.conf b/sdk/std/bind.conf
new file mode 100644
index 0000000..65ee123
--- /dev/null
+++ b/sdk/std/bind.conf
@@ -0,0 +1,69 @@
+BIND_OPTS=$BIND_OPTS' cc optimize cflags arch'
+OPTIMIZE=''
+CFLAGS=''
+
+if test -z "$CONFIG_CC" ; then
+
+ echo -n "Analyzing C Compiler..."
+
+ if test -z "$CONFIG_ARCH" ; then
+ CONFIG_ARCH=`uname -m`"-"`uname`
+ fi
+
+ if fn_find_fpath -x gcc $PATH ; then
+ CONFIG_CC='gcc'
+ echo "gcc"
+ else
+ if test -z "$CONFIG_CC" ; then
+ CONFIG_CC='cc'
+ echo 'cc'
+ fi
+ fi
+fi
+
+opt_optimize() {
+ OPTIMIZE="$1"
+ CONFIG_COPT="$1"
+ return 0
+}
+
+opt_cflags() {
+ CONFIG_ENDIAN=""
+ CONFIG_CFLAGS="$1"
+ CFLAGS="$1"
+}
+
+opt_cc() {
+ CONFIG_CC="$1"
+ CONFIG_COPT="$OPTIMIZE"
+ CONFIG_CFLAGS="$CFLAGS"
+ return 0
+}
+
+opt_arch() {
+ CONFIG_ENDIAN=""
+ CONFIG_ARCH="$1"
+ if test "gcc" = $CONFIG_CC ; then
+ CONFIG_COPT="$OPTIMIZE"
+ if test -d /usr/local/lib/gcc-lib ; then
+ GCC_LIB='/usr/local/lib/gcc-lib'
+ fi
+ if test -d /usr/lib/gcc-lib ; then
+ GCC_LIB='/usr/lib/gcc-lib'
+ fi
+ if fn_find_fpath -d "$1" "$GCC_LIB"':/usr:/usr/local' ; then
+ CONFIG_CFLAGS='-b '"$1"
+ else
+ echo "config: $1: unsupported gcc architecture"
+ exit -1
+ fi
+ if -d /usr/$1/include ; then
+ CONFIG_HOST=/usr/$1
+ fi
+ if -d /usr/local/$1/include ; then
+ CONFIG_HOST=/usr/local/$1
+ fi
+ fi
+ return 0
+}
+
diff --git a/sdk/std/files.h b/sdk/std/files.h
new file mode 100644
index 0000000..84ad33a
--- /dev/null
+++ b/sdk/std/files.h
@@ -0,0 +1,47 @@
+/*
+ * Portable support for file manipulation and access related functions.
+ * $Id$
+ * Copyright (c) 1997 by Tycho Softworks.
+ * For conditions of distribution and reuse see product license.
+ */
+
+#ifndef __STD_FILES_H__
+#define __STD_FILES_H__
+
+#ifndef __STD_TYPES_H__
+#include <std/types.h>
+#endif
+
+#include <stdio.h>
+#include <sys/stat.h>
+
+#ifndef UNISTD_H_MISSING
+#include <unistd.h>
+#endif
+
+#ifndef SYS_FCNTL_H_MISSING
+#include <sys/fcntl.h>
+#else
+#ifndef FCNTL_H_MISSING
+#include <fcntl.h>
+#endif
+#endif
+
+#ifndef IO_H_MISSING
+#include <io.h>
+#endif
+
+#ifndef __STD_TYPES_H__
+#include <std/types.h>
+#endif
+
+
+#ifdef OFF_T_MISSING
+typedef long off_t;
+#endif
+
+#ifdef FD_T_MISSING
+typedef int fd_t;
+#endif
+
+#endif
diff --git a/sdk/std/help.conf b/sdk/std/help.conf
new file mode 100644
index 0000000..71dfb97
--- /dev/null
+++ b/sdk/std/help.conf
@@ -0,0 +1,4 @@
+--arch= Compiler Architecture / Cross-Compile
+--cc= Specify C Compiler to use
+--cflags= Specify Compiler Options
+--optimize= Specify Compiler Optimizations
diff --git a/sdk/std/limits.h b/sdk/std/limits.h
new file mode 100644
index 0000000..0766fe3
--- /dev/null
+++ b/sdk/std/limits.h
@@ -0,0 +1,97 @@
+/*
+ * Portable re-definition of limits header file.
+ * $Id$
+ * Copyright (c) 1997 by Tycho Softworks.
+ * For conditions of distribution and reuse see product license.
+ */
+
+#ifndef __STD_LIMITS_H__
+#define __STD_LIMITS_H__
+
+#include <limits.h>
+
+#ifndef __CONFIG_H__
+#include <config.h>
+#endif
+
+#ifndef POSIX1_LIM_H_MISSING
+#include <posix1_lim.h>
+#else
+#ifndef UNISTD_H_MISSING
+#include <unistd.h>
+#endif
+#include <std/posix1_lim.h>
+#endif
+
+#ifndef NR_OPEN
+#ifdef OPEN_MAX
+#define NR_OPEN OPEN_MAX
+#else
+#define NR_OPEN _POSIX_OPEN_MAX
+#endif
+#endif
+
+#ifndef NGROUPS_MAX
+#define NGROUPS_MAX _POSIX_NGROUPS_MAX
+#endif
+
+#ifndef CHILD_MAX
+#define CHILD_MAX _POSIX_CHILD_MAX
+#endif
+
+#ifndef ARG_MAX
+#define ARG_MAX _POSIX_ARG_MAX
+#endif
+
+#ifndef LINK_MAX
+#define LINK_MAX _POSIX_LINK_MAX
+#endif
+
+#ifndef MAX_CANON
+#define MAX_CANON _POSIX_MAX_CANON
+#endif
+
+#ifndef MAX_INPUT
+#define MAX_INPUT _POSIX_MAX_INPUT
+#endif
+
+#ifndef NAME_MAX
+#define NAME_MAX _POSIX_NAME_MAX
+#endif
+
+#ifndef PATH_MAX
+#define PATH_MAX _POSIX_PATH_MAX
+#endif
+
+#ifndef PIPE_BUF
+#define PIPE_BUF _POSIX_PIPE_BUF
+#endif
+
+#ifndef SSIZE_MAX
+#define SSIZE_MAX INT_MAX
+#endif
+
+#ifndef STREAM_MAX
+#define STREAM_MAX OPEN_MAX
+#endif
+
+#ifndef TZONE_MAX
+#define TZONE_MAX _POSIX_TZONE_MAX
+#endif
+
+#ifdef MSDOS
+#if !defined(GNU) && !defined(__386__)
+#if defined(__BORLANDC__) && (defined(__SMALL__) || defined(__MEDIUM__))
+#define MEM_SEGMENT_MAX 16
+#endif
+#if defined(M_I86SM) || defined(M_I86MM))
+#define MEM_SEGMENT_MAX 16
+#endif
+#endif
+#endif
+
+#ifndef MEM_SEGMENT_MAX
+#define MEM_SEGMENT_MAX 32
+#endif
+
+#endif
diff --git a/sdk/std/make.conf b/sdk/std/make.conf
new file mode 100644
index 0000000..bf20113
--- /dev/null
+++ b/sdk/std/make.conf
@@ -0,0 +1,102 @@
+if test "$CONFIG_CC" = gcc ; then
+
+ CONFIG_FPIC='-fpic'
+ CONFIG_EMPTY="0"
+ if test -z "$CONFIG_GCC_GFLAG" ; then
+ echo 'void f(){}' >conftest.c
+ if gcc -g -c conftest.c 2>&1 >/dev/null ; then
+ CONFIG_CFLAGS='-g '$CONFIG_CFLAGS
+ CONFIG_GCC_GFLAG='yes'
+ else
+ CONFIG_GCC_GFLAG='no'
+ fi
+ fi
+ if test -z "$CONFIG_COPT" ; then
+ case "$CONFIG_ARCH" in
+ i486* | i586* | i686*)
+ CONFIG_COPT='-O2 -m486'
+ ;;
+ *)
+ CONFIG_COPT='-O2'
+ esac
+ fi
+else
+ CONFIG_FPIC=''
+ CONFIG_EMPTY=""
+ if test -z "$CONFIG_CFLAGS" ; then
+ case "$CONFIG_ARCH" in
+ *-SCO_SV)
+ CONFIG_CFLAGS='-b elf'
+ CONFIG_COPT='-O3'
+ CONFIG_FPIC='-KPIC'
+ ;;
+ esac
+ fi
+
+ if test -z "$CONFIG_COPT" ; then
+ CONFIG_COPT='-O'
+ fi
+fi
+
+echo "#define EMPTY "$CONFIG_EMPTY >>$CONFIG
+
+echo "CC="$CONFIG_CC >>config.make
+echo "CFLAGS="$CONFIG_CFLAGS >>config.make
+echo "PICFLAG="$CONFIG_FPIC >>config.make
+echo "OPTIMIZE="$CONFIG_COPT >>config.make
+
+inc=$CONFIG_HOST/include
+typelist=`find $inc -name types.h -follow -print`
+
+echo 'CONFIG_CC="'$CONFIG_CC'"' >>config.cache
+echo 'CONFIG_COPT="'$CONFIG_COPT'"' >>config.cache
+echo 'CONFIG_ARCH="'$CONFIG_ARCH'"' >>config.cache
+echo 'CONFIG_CFLAGS="'$CONFIG_CFLAGS'"' >>config.cache
+echo 'CONFIG_PICFLAG="'$CONFIG_FPIC'"' >>config.cache
+echo 'CONFIG_GCC_GFLAG="'$CONFIG_GCC_GFLAG'"' >>config.cache
+echo 'CONFIG_HOST="'$CONFIG_HOST'"' >>config.cache
+
+fn_find_type UCHAR_T_MISSING "uchar;" $typelist
+fn_find_type USHORT_T_MISSING "ushort;" $typelist
+fn_find_type ULONG_T_MISSING "ulong;" $typelist
+fn_find_type SIZE_T_MISSING "size_t;" $typelist
+fn_find_type SSIZE_T_MISSING "ssize_t;" $typelist
+fn_find_type PID_T_MISSING "pid_t;" $typelist $inc/unistd.h
+fn_find_type OFF_T_MISSING "off_t;" $typelist $inc/stdio.h $inc/fcntl.h $inc/sys/fcntl.h $inc/io.h
+fn_find_type FD_T_MISSING "fd_t;" $typelist:$inc/stdio.h
+
+if fn_find_type GNUSTRING_F_MISSING "strcasecmp" $inc/string.h ; then
+ fn_find_type STRICMP_F_MISSING "stricmp" $inc/string.h
+fi
+
+fn_find_type STRLWR_F_MISSING "strlwr" $inc/string.h
+fn_find_type STRDUP_F_MISSING "strdup" $inc/string.h
+fn_find_type STRISTR_F_MISSING "stristr" $inc/string.h
+fn_find_type SELECT_F_MISSING "select" $inc/select.h $inc/sys/select.h $inc/sys/time.h
+fn_find_type GETUTENT_F_MISSING "getutent" $inc/utmp.h
+
+fn_find_type UT_USER_I_MISSING "ut_user" $inc/utmp.h
+
+fn_find_file POSIX1_LIM_H_MISSING $inc/posix1_lim.h
+fn_find_file PROCESS_H_MISSING $inc/process.h
+fn_find_file UNISTD_H_MISSING $inc/unistd.h
+fn_find_file POSIX2_LIM_H_MISSING $inc/posix2_lim.h
+fn_find_file SYS_SELECT_H_MISSING $inc/sys/select.h
+fn_find_file SELECT_H_MISSING $inc/select.h
+fn_find_file POLL_H_MISSING $inc/poll.h
+fn_find_file SYS_POLL_H_MISSING $inc/sys/poll.h
+
+if fn_find_file WAIT_H_MISSING $inc/wait.h ; then
+ fn_find_file SYS_WAIT_H_MISSING $inc/sys/wait.h
+fi
+fn_find_file POSIX_OPT_H_MISSING $inc/posix_opt.h
+fn_find_file CONFNAME_H_MISSING $inc/confname.h
+fn_find_file SYSCONF_H_MISSING $inc/sysconf.h
+fn_find_file ENV_H_MISSING $inc/env.h
+fn_find_file SYSEXITS_H_MISSING $inc/sysexits.h
+fn_find_file SYS_TIME_H_MISSING $inc/sys/time.h
+if fn_find_file SYS_FCNTL_H_MISSING $inc/sys/fcntl.h ; then
+ fn_find_file FCNTL_H_MISSING $inc/fcntl.h
+fi
+fn_find_file IO_H_MISSING $inc/io.h
+
diff --git a/sdk/std/math.h b/sdk/std/math.h
new file mode 100644
index 0000000..d1eb298
--- /dev/null
+++ b/sdk/std/math.h
@@ -0,0 +1,31 @@
+/*
+ * Common math functions and macros.
+ * $Id$
+ * Copyright (c) 1997 by Tycho Softworks.
+ * For conditions of distribution and reuse see product license.
+ */
+
+#ifndef __STD_MATH_H__
+#define __STD_MATH_H__
+
+#ifndef __STD_TYPES_H__
+#include <std/types.h>
+#endif
+
+#ifndef min
+#define min(a, b) ((a)<(b)?(a):(b))
+#endif
+
+#ifndef max
+#define max(a, b) ((a)>(b)?(a):(b))
+#endif
+
+#ifndef abs
+#define abs(a) ((a)<0?(-a):(a))
+#endif
+
+#ifndef align
+#define align(x, s) ((((x) + (s) - 1) / (s)) *(s))
+#endif
+
+#endif
diff --git a/sdk/std/poll.h b/sdk/std/poll.h
new file mode 100644
index 0000000..a9eb3f9
--- /dev/null
+++ b/sdk/std/poll.h
@@ -0,0 +1,21 @@
+/*
+ * Find or insert replacement "poll" routine.
+ * $Id$
+ * Copyright (c) 1997 by Tycho Softworks.
+ * For conditions of distribution and use see product license.
+ */
+
+#ifndef __STD_POLL_H__
+#define __STD_POLL_H__
+
+#ifdef POLL_H_MISSING
+#ifndef SYS_POLL_H_MISSING
+#include <sys/poll.h>
+#endif
+#else
+#include <poll.h>
+#endif
+
+#include <std/time.h>
+
+#endif
diff --git a/sdk/std/posix1_lim.h b/sdk/std/posix1_lim.h
new file mode 100644
index 0000000..5520f22
--- /dev/null
+++ b/sdk/std/posix1_lim.h
@@ -0,0 +1,92 @@
+/* Copyright (C) 1991, 1992 Free Software Foundation, Inc.
+This file is part of the GNU C Library.
+
+The GNU C Library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public License as
+published by the Free Software Foundation; either version 2 of the
+License, or (at your option) any later version.
+
+The GNU C Library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB. If
+not, write to the Free Software Foundation, Inc., 675 Mass Ave,
+Cambridge, MA 02139, USA. */
+
+/*
+ * POSIX Standard: 2.9.2 Minimum Values Added to <limits.h>
+ */
+
+#ifndef _POSIX1_LIMITS_H
+
+#define _POSIX1_LIMITS_H 1
+
+
+/* These are the standard-mandated minimum values. */
+
+/* Maximum length of arguments to `execve', including environment. */
+#define _POSIX_ARG_MAX 4096
+
+/* Maximum simultaneous processes per real user ID. */
+#define _POSIX_CHILD_MAX 6
+
+/* Maximum link count of a file. */
+#define _POSIX_LINK_MAX 8
+
+/* Number of bytes in a terminal canonical input queue. */
+#define _POSIX_MAX_CANON 255
+
+/* Number of bytes for which space will be
+ available in a terminal input queue. */
+#define _POSIX_MAX_INPUT 255
+
+/* Number of simultaneous supplementary group IDs per process. */
+#define _POSIX_NGROUPS_MAX 0
+
+/* Number of files one process can have open at once. */
+#define _POSIX_OPEN_MAX 16
+
+/* Number of bytes in a filename. */
+#define _POSIX_NAME_MAX 14
+
+/* Number of bytes in a pathname. */
+#define _POSIX_PATH_MAX 255
+
+/* Number of bytes than can be written atomically to a pipe. */
+#define _POSIX_PIPE_BUF 512
+
+/* Largest value of a `ssize_t'. */
+#define _POSIX_SSIZE_MAX 32767
+
+/* Number of streams a process can have open at once. */
+#define _POSIX_STREAM_MAX 8
+
+/* Number of bytes in `tzname'. */
+#define _POSIX_TZNAME_MAX 3
+
+
+/* don't even think about changing it without checking tzfile.h
+ * in source code dir ./time first.
+ */
+#undef TZNAME_MAX
+#define TZNAME_MAX 50
+
+#ifndef SSIZE_MAX
+#define SSIZE_MAX INT_MAX
+#endif
+
+#ifndef STREAM_MAX
+#define STREAM_MAX OPEN_MAX
+#endif
+
+/* This value is a guaranteed minimum maximum.
+ The current maximum can be got from `sysconf'. */
+
+#ifndef NGROUPS_MAX
+#define NGROUPS_MAX _POSIX_NGROUPS_MAX
+#endif
+
+#endif /* posix1_limits.h */
diff --git a/sdk/std/process.h b/sdk/std/process.h
new file mode 100644
index 0000000..2fdf6ae
--- /dev/null
+++ b/sdk/std/process.h
@@ -0,0 +1,99 @@
+/*
+ * Portable process handling routines.
+ * $Id$
+ * Copyright (c) 1997 by Tycho Softworks.
+ * For conditions of distribution and reuse see product license.
+ */
+
+#ifndef __STD_PROCESS_H__
+#define __STD_PROCESS_H__
+
+#ifndef __STD_TYPES_H__
+#include <std/types.h>
+#endif
+
+#ifndef __STD_LIMITS_H__
+#include <std/limits.h>
+#endif
+
+#ifndef POSIX2_LIM_H_MISSING
+#include <posix2_lim.h>
+#endif
+
+#ifndef POSIX_OPT_H_MISSING
+#include <posix_opt.h>
+#endif
+
+#ifndef UNISTD_H_MISSING
+#include <unistd.h>
+#endif
+
+#ifndef _SC_OPEN_MAX
+#ifndef CONFNAME_H_MISSING
+#include <confname.h>
+#else
+#ifndef SYSCONF_H_MISSING
+#include <sysconf.h>
+#endif
+#endif
+#endif
+
+#ifndef PROCESS_H_MISSING
+#include <process.h>
+#endif
+
+#ifndef WAIT_H_MISSING
+#include <wait.h>
+#else
+#ifndef SYS_WAIT_H_MISSING
+#include <sys/wait.h>
+#endif
+#endif
+
+#ifndef ENV_H_MISSING
+#include <env.h>
+#endif
+
+#ifndef SYSEXITS_H_MISSING
+#include <sysexits.h>
+#else
+#include <std/sysexits.h>
+#endif
+
+/* We now re-evaluate system limits using runtime sysconf() values */
+
+#ifdef _SC_ARG_MAX
+#undef ARG_MAX
+#define ARG_MAX (sysconf(_SC_ARG_MAX))
+#endif
+
+#ifdef _SC_CHILD_MAX
+#undef CHILD_MAX
+#define CHILD_MAX (sysconf(_SC_CHILD_MAX))
+#endif
+
+#ifdef _SC_NGROUPS_MAX
+#undef NGROUPS_MAX
+#define NGROUPS_MAX (sysconf(_SC_NGROUPS_MAX))
+#endif
+
+#ifdef _SC_OPEN_MAX
+#undef OPEN_MAX
+#define OPEN_MAX (sysconf(_SC_OPEN_MAX))
+#endif
+
+#ifdef _SC_STREAM_MAX
+#undef STREAM_MAX
+#define STREAM_MAX (sysconf(_SC_STREAM_MAX))
+#endif
+
+#ifdef _SC_TZNAME_MAX
+#undef TZNAME_MAX
+#define TZNAME_MAX (sysconf(_SC_TZNAME_MAX))
+#endif
+
+#ifdef PID_T_MISSING
+typedef int pid_t;
+#endif
+
+#endif
diff --git a/sdk/std/select.h b/sdk/std/select.h
new file mode 100644
index 0000000..2812581
--- /dev/null
+++ b/sdk/std/select.h
@@ -0,0 +1,21 @@
+/*
+ * Find or use "replacement" select routines.
+ * $Id$
+ * Copyright (c) 1997 by Tycho Softworks.
+ * For conditions of distribution and use see license.
+ */
+
+#ifndef __STD_SELECT_H__
+#define __STD_SELECT_H__
+
+#ifdef SELECT_H_MISSING
+#ifndef SYS_SELECT_H_MISSING
+#include <sys/select.h>
+#endif
+#else
+#include <select.h>
+#endif
+
+#include <std/time.h>
+
+#endif
diff --git a/sdk/std/signal.h b/sdk/std/signal.h
new file mode 100644
index 0000000..b56b48a
--- /dev/null
+++ b/sdk/std/signal.h
@@ -0,0 +1,11 @@
+#ifndef __STD_SIGNAL_H__
+#define __STD_SIGNAL_H__
+
+#ifndef __CONFIG_H__
+#include <config.h>
+#endif
+
+#include <signal.h>
+
+#endif
+
diff --git a/sdk/std/string.c b/sdk/std/string.c
new file mode 100644
index 0000000..6f9649e
--- /dev/null
+++ b/sdk/std/string.c
@@ -0,0 +1,110 @@
+/*
+ * Define constants used by other string services and case insensitive
+ * compare and conversion functions missing in some libc distributions.
+ * $Id$
+ * Copyright (c) 1997 by Tycho Softworks.
+ * For conditions of distribution and reuse see product license.
+ */
+
+#include <std/string.h>
+
+#ifdef STRLWR_F_MISSING
+
+char *strlwr(char *s)
+{
+ char *old;
+
+ if(!s)
+ return NULL;
+
+ old=s;
+ while(*s = (char)tolower(*s))
+ ++s;
+
+ return old;
+}
+
+char *strupr(char *s)
+{
+ char *old;
+
+ if(!s)
+ return NULL;
+
+ old=s;
+ while(*s = (char)toupper(*s))
+ ++s;
+ return old;
+}
+
+#endif
+
+#ifdef STRDUP_F_MISSING
+
+char *strdup(str)
+char *str;
+{
+ char *new = (char *)malloc(strlen(str) + 1);
+ if(!new)
+ return NULL;
+
+ return strcpy(new, str);
+}
+
+#endif
+
+#ifdef STRICMP_F_MISSING
+
+int stricmp(const char *s1, const char *s2)
+{
+ int t;
+
+ while(*s1 && *s2)
+ {
+ if (t=tolower(*s1)-tolower(*s2))
+ return t;
+
+ ++s1;
+ ++s2;
+ }
+ return tolower(*s1)-tolower(*s2);
+}
+
+int strnicmp(const char *s1,const char *s2, size_t n)
+{
+ int t;
+
+ while (n--)
+ {
+ if (t=tolower(*s1)-tolower(*s2))
+ return t;
+
+ if (!*s1)
+ return 0;
+
+ ++s1;
+ ++s2;
+ }
+ return 0;
+}
+
+#endif
+
+#ifdef STRISTR_F_MISSING
+
+char *stristr(char *s1, const char *s2)
+{
+ int len = strlen(s2);
+ int count = strlen(s1) - len + 1;
+
+ while(count--)
+ {
+ if(!strnicmp(s1, s2, len))
+ return s1;
+ ++s1;
+ }
+ return NULL;
+}
+
+#endif
+
diff --git a/sdk/std/string.h b/sdk/std/string.h
new file mode 100644
index 0000000..bf642cf
--- /dev/null
+++ b/sdk/std/string.h
@@ -0,0 +1,75 @@
+/*
+ * Portable string handling routines.
+ * $Id$
+ * Copyright (c) 1997 by Tycho Softworks.
+ * For conditions of distribution and reuse see product license.
+ */
+
+#ifndef __STD_STRINGS_H__
+#define __STD_STRINGS_H__
+
+#ifndef __STD_TYPES_H__
+#include <std/types.h>
+#endif
+
+#include <string.h>
+#include <ctype.h>
+
+#ifndef STRCASECMP_F_MISSING
+#define stricmp(s1, s2) strcasecmp(s1, s2)
+#define strnicmp(s1, s2, n) strncasecmp(s1, s2, n)
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __NAMESPACE
+#define __SPACES __NAMESPACE(__SPACES)
+#endif
+
+extern char __SPACES[];
+
+#ifdef STRICMP_F_MISSING
+#ifdef __NAMESPACE
+#define stricmp __NAMESPACE(stricmp)
+#define strnicmp __NAMESPACE(strnicmp)
+#endif
+
+int stricmp(const char *s1, const char *s2);
+int strnicmp(const char *s1, const char *s2, size_t n);
+#endif
+
+#ifdef STRLWR_F_MISSING
+
+#ifdef __NAMESPACE
+#define strupr __NAMESPACE(strupr)
+#define strlwr __NAMESPACE(strlwr)
+#endif
+
+char *strlwr(char *s1);
+char *strupr(char *s2);
+#endif
+
+#ifdef STRDUP_F_MISSING
+
+#ifdef __NAMESPACE
+#define strdup __NAMESPACE(strdup)
+#endif
+
+char *strdup(const char *s);
+#endif
+
+#ifdef STRISTR_F_MISSING
+#ifdef __NAMESPACE
+#define stristr __NAMESPACE(stristr)
+#endif
+
+char *stristr(char *s1, const char *s2);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/sdk/std/sysexits.h b/sdk/std/sysexits.h
new file mode 100644
index 0000000..208ec0e
--- /dev/null
+++ b/sdk/std/sysexits.h
@@ -0,0 +1,118 @@
+/*
+ * Copyright (c) 1987 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.
+ *
+ * @(#)sysexits.h 4.8 (Berkeley) 4/3/91
+ */
+
+#ifndef _SYSEXITS_H
+#define _SYSEXITS_H
+
+/*
+ * 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, /etc/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.
+ */
+
+#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 */
+
+#define EX__MAX 78 /* maximum listed value */
+
+#endif /* !_SYSEXITS_H */
diff --git a/sdk/std/time.h b/sdk/std/time.h
new file mode 100644
index 0000000..45c42cb
--- /dev/null
+++ b/sdk/std/time.h
@@ -0,0 +1,23 @@
+/*
+ * Portable header access into time functions.
+ * $Id$
+ * Copyright (c) 1997 by Tycho Softworks.
+ * For conditions of distribution and reuse see product license.
+ */
+
+#ifndef __STD_TIME_H__
+#define __STD_TIME_H__
+
+#ifndef __CONFIG_H__
+#include <config.h>
+#endif
+
+#include <time.h>
+
+#ifndef SYS_TIME_H_MISSING
+#include <sys/time.h>
+#endif
+
+#endif
+
+
diff --git a/sdk/std/types.h b/sdk/std/types.h
new file mode 100644
index 0000000..ebd4ea7
--- /dev/null
+++ b/sdk/std/types.h
@@ -0,0 +1,54 @@
+/*
+ * Portable common datatype declarations.
+ * $Id$
+ * Copyright (c) 1997 by Tycho Softworks.
+ * For conditions of distribution and reuse see product license.
+ */
+
+#ifndef __STD_TYPES_H__
+#define __STD_TYPES_H__
+
+#ifndef __CONFIG_H__
+#include <config.h>
+#endif
+
+#include <sys/types.h>
+#include <stdlib.h>
+
+#ifdef UCHAR_T_MISSING
+typedef unsigned char uchar;
+#endif
+
+#ifdef USHORT_T_MISSING
+typedef unsigned short ushort;
+#endif
+
+#ifdef ULONG_T_MISSING
+typedef unsigned long ulong;
+#endif
+
+#ifdef __cplusplus
+enum
+{
+ FALSE=0,
+ TRUE
+};
+#else
+typedef enum
+{
+ FALSE=0,
+ TRUE
+} bool;
+#endif
+
+typedef void *ptr_t;
+
+#ifdef SIZE_T_MISSING
+typedef unsigned int size_t;
+#endif
+
+#ifdef SSIZE_T_MISSING
+typedef int ssize_t;
+#endif
+
+#endif
diff --git a/sdk/std/utmp.c b/sdk/std/utmp.c
new file mode 100644
index 0000000..78cbf64
--- /dev/null
+++ b/sdk/std/utmp.c
@@ -0,0 +1,49 @@
+/*
+ * Portable emulation of utmp access routines, such as for broken BSD.
+ * $Id$
+ * Copyright (c) 1997 by Tycho Softworks.
+ * For conditions of distribution and use see license.
+ */
+
+#include <std/utmp.h>
+#include <std/files.h>
+
+#ifdef GETUTENT_F_MISSING
+
+static fd_t ut = -1;
+static struct utmp utmp;
+
+void setutent(void)
+{
+ if(ut < 0)
+ ut = open(_PATH_UTMP, O_RDONLY);
+ if(ut < 0)
+ return;
+
+ lseek(ut, 0l, SEEK_SET);
+}
+
+void endutent(void)
+{
+ if(ut > -1)
+ {
+ close(ut);
+ ut = -1;
+ }
+}
+
+struct utmp *getutent(void)
+{
+ if(ut < 0)
+ setutent();
+
+ if(ut < 0)
+ return NULL;
+
+ if(read(ut, &utmp, sizeof(utmp)) < sizeof(utmp))
+ return NULL;
+
+ return &utmp;
+}
+
+#endif
diff --git a/sdk/std/utmp.h b/sdk/std/utmp.h
new file mode 100644
index 0000000..2ac67f4
--- /dev/null
+++ b/sdk/std/utmp.h
@@ -0,0 +1,31 @@
+/*
+ * utmp file access interface, local or ported.
+ * $Id$
+ * Copyright (c) 1997 by Tycho Softworks.
+ * For conditions of distribution and use see license.
+ */
+
+#ifndef __STD_UTMP_H__
+#define __STD_UTMP_H__
+
+#ifndef __STD_TYPES_H__
+#include <std/types.h>
+#endif
+
+#include <utmp.h>
+
+#ifndef _UTMP_PATH
+#define _UTMP_PATH "/etc/utmp.h"
+#endif
+
+#ifdef UT_USER_I_MISSING
+#define ut_user ut_name
+#endif
+
+#ifdef GETUTENT_F_MISSING
+void setutent(void);
+void endutent(void);
+struct utmp *getutent(void);
+#endif
+
+#endif