koreth%panarthea.ebay@sun.com (Steven Grimm) (08/20/89)
Submitted-by: uunet.UU.NET!unido!sbsvax!roeder (Edgar Roeder)
Posting-number: Volume 2, Issue 73
Archive-name: gcclib2/part02
#! /bin/sh
# This is a shell archive. Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file". To overwrite existing
# files, type "sh file -c". You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g.. If this archive is complete, you
# will see the following message at the end:
# "End of archive 2 (of 7)."
# Contents: atexit.c close.c closedir.c.cdiff console.c.cdiff
# convert.c ctime.c fclose.c fflush.c fopen.c getwd.c
# include/ctype.h include/dir.h include/fcntl.h include/file.h
# include/ioctl.h include/siglist.h include/sysvars.h
# include/tchars.h isatty.c.cdiff localtim.c pause.c sfguts.c.cdiff
# std-guts.h strstr.c tchars.c trap-14.c
# Wrapped by roeder@sbsvax on Wed Aug 16 22:02:58 1989
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'atexit.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'atexit.c'\"
else
echo shar: Extracting \"'atexit.c'\" \(671 characters\)
sed "s/^X//" >'atexit.c' <<'END_OF_FILE'
X/* we allow atexit-registration of an arbitrary number of functions */
X/* ANSI C requires at least 32 -> we should reserve memory for this amount */
X/* but hopefully we can always get what we want */
X
Xextern struct func_list {
X void (*func)(void);
X struct func_list *next_entry;
X} *_atexit_list; /* defined in exit.c */
X
Xint
Xatexit(void (*func)(void))
X{
X struct func_list *new_entry;
X extern char *malloc();
X
X if(new_entry = (struct func_list *) malloc(sizeof(struct func_list))) {
X new_entry->func = func;
X new_entry->next_entry = _atexit_list;
X _atexit_list = new_entry;
X return(0); /* successfull registration */
X } else return(-1); /* registration failed */
X}
END_OF_FILE
if test 671 -ne `wc -c <'atexit.c'`; then
echo shar: \"'atexit.c'\" unpacked with wrong size!
fi
# end of 'atexit.c'
fi
if test -f 'close.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'close.c'\"
else
echo shar: Extracting \"'close.c'\" \(745 characters\)
sed "s/^X//" >'close.c' <<'END_OF_FILE'
X/*
X * Cross Development System for Atari ST
X * Copyright (c) 1988, Memorial University of Newfoundland
X *
X * $Header: close.c,v 1.2 88/01/29 17:30:58 m68k Exp $
X *
X * $Log: close.c,v $
X * Revision 1.1 88/01/29 17:30:58 m68k
X * Initial revision
X *
X * 1.2 jrd
X *
X */
X#include <osbind.h>
X#include <file.h>
X
X#ifdef DEBUG
Xextern int stderr;
X#endif
X
Xint close(fd)
X int fd;
X{
X extern int errno;
X int rval;
X
X if (fd == 1234) return(0); /* /dev/null */
X if ((rval = Fclose(fd)) < 0) {
X errno = -rval;
X rval = -1;
X }
X if ((fd >= 0) && (fd < N_HANDLES)) {
X __handle_stat[fd] = FH_UNKNOWN;
X free(__handle_to_name[fd]);
X __handle_to_name[fd] = (char *) 0;
X }
X#ifdef DEBUG
X fprintf(stderr, "close(%d)->%d\n", fd, rval);
X#endif
X return rval;
X}
END_OF_FILE
if test 745 -ne `wc -c <'close.c'`; then
echo shar: \"'close.c'\" unpacked with wrong size!
fi
# end of 'close.c'
fi
if test -f 'closedir.c.cdiff' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'closedir.c.cdiff'\"
else
echo shar: Extracting \"'closedir.c.cdiff'\" \(627 characters\)
sed "s/^X//" >'closedir.c.cdiff' <<'END_OF_FILE'
X*** terminator/closedir.c Fri Aug 11 18:51:54 1989
X--- new-lib/closedir.c Sat Jul 15 13:39:30 1989
X***************
X*** 22,23 ****
X--- 22,24 ----
X static void free_dircontents();
X+ extern DIR *_current_open_directory;
X
X***************
X*** 27,29 ****
X--- 28,45 ----
X {
X+ DIR *dp;
X+
X free_dircontents(dirp->dd_contents);
X+ free(dirp->dd_name);
X+ dp = _current_open_directory;
X+ if(dp == dirp) {
X+ _current_open_directory = dp->dd_next;
X+ } else {
X+ while(dp->dd_next) {
X+ if(dp->dd_next == dirp) {
X+ dp->dd_next = dirp->dd_next;
X+ break;
X+ }
X+ dp = dp->dd_next;
X+ }
X+ }
X free((char *) dirp);
END_OF_FILE
if test 627 -ne `wc -c <'closedir.c.cdiff'`; then
echo shar: \"'closedir.c.cdiff'\" unpacked with wrong size!
fi
# end of 'closedir.c.cdiff'
fi
if test -f 'console.c.cdiff' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'console.c.cdiff'\"
else
echo shar: Extracting \"'console.c.cdiff'\" \(941 characters\)
sed "s/^X//" >'console.c.cdiff' <<'END_OF_FILE'
X*** terminator/console.c Fri Aug 11 18:51:55 1989
X--- new-lib/console.c Tue Aug 15 21:08:16 1989
X***************
X*** 1,2 ****
X-
X /* console IO stuff. Abstracted out here cause I'm having so much trouble
X--- 1 ----
X***************
X*** 10,11 ****
X--- 9,16 ----
X Sigh.
X+
X+ There seem to be some people in the atari st community who have never
X+ heard about the st's character set. There are some chars > 0x7F which
X+ can be printed. And they will be printed.
X+ This code assumes that nowbody tries to read from stderr if stdin is
X+ redirected to AUX:.
X */
X***************
X*** 20,23 ****
X
X! Fread(gem_handle, 1L, &c[0]);
X! return(c[0] & 0xFF);
X }
X--- 25,29 ----
X
X! return(Bconin(2)); /* isatty(gem_handle) == TRUE */
X! /* Fread(gem_handle, 1L, &c[0]);
X! return(c[0] & 0xFF); */
X }
X***************
X*** 44,46 ****
X {
X! return(0);
X /*
X--- 50,53 ----
X {
X! return(Bconstat(2));
X! /* return(0); */
X /*
END_OF_FILE
if test 941 -ne `wc -c <'console.c.cdiff'`; then
echo shar: \"'console.c.cdiff'\" unpacked with wrong size!
fi
# end of 'console.c.cdiff'
fi
if test -f 'convert.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'convert.c'\"
else
echo shar: Extracting \"'convert.c'\" \(1007 characters\)
sed "s/^X//" >'convert.c' <<'END_OF_FILE'
X/* convert a unix-style filename to its TOS equivalent
X * /dev/A/dir/file.ext --> A:\DIR\FILE.EXT
X *
X * (er) : Added check for root directories (name ends after '/dev/A').
X *
X */
X
X#include <ctype.h>
X
Xchar *
Xunix_to_tos(char *fname)
X{
X char *p;
X
X if(fname) {
X for(p = fname; *p; p++)
X if(*p == '/') *p = '\\';
X else if(islower(*p)) *p = toupper(*p);
X if(!strncmp(fname,"\\DEV\\",5)) {
X if(!strcmp(fname+5,"TTY")) {
X strcpy(fname,"CON:");
X } else if(fname[5] && !fname[6] || fname[6] == '\\') {
X strcpy(fname+1,fname+5);
X fname[0] = fname[1];
X fname[1] = ':';
X }
X }
X }
X return(fname);
X}
X
X/* convert a TOS-style filename to its unix equivalent
X * A:\DIR\FILE.EXT --> a:/dir/file.ext
X * i would like to do: A:\DIR\FILE.EXT --> /dev/A/dir/file.ext, but this
X * would require to allocate room for the bigger string
X *
X */
Xchar *
Xtos_to_unix(char *fname)
X{
X char *p;
X
X if(fname) for(p = fname; *p; p++)
X if(*p == '\\') *p = '/';
X else if(isupper(*p)) *p = tolower(*p);
X return(fname);
X}
END_OF_FILE
if test 1007 -ne `wc -c <'convert.c'`; then
echo shar: \"'convert.c'\" unpacked with wrong size!
fi
# end of 'convert.c'
fi
if test -f 'ctime.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'ctime.c'\"
else
echo shar: Extracting \"'ctime.c'\" \(887 characters\)
sed "s/^X//" >'ctime.c' <<'END_OF_FILE'
X/*
X * char *ctime (zeiger auf(anzahl der sekunden seit 1.1.1970 0.00 GMT))
X * die anzahl der sekunden liefert normalerweise time()
X *
X * rueckgabe: ein string der laenge 26 bytes im format
X * DDD MMM dd hh:mm:ss YYYY\n\0
X * bsp: Wed Sep 04 15:13:00 1985\n\0
X *
X * stefan brueck 31/12/88
X */
X
X#include <time.h>
X
Xchar ctime_buf[26]; /* is it safe to use a static one? */
X
Xchar * month_name[] = {"???", "Jan", "Feb", "Mar", "Apr", "May", "Jun",
X "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
Xchar * day_name[] = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"};
X
Xchar * ctime(date_and_time)
Xlong * date_and_time;
X{
X struct tm *ut;
X
X ut = localtime(date_and_time);
X sprintf(ctime_buf, "%s %s %02d %02d:%02d:%02d %04d\n",day_name[ut->tm_wday], month_name[(ut->tm_mon)+1], ut->tm_mday, ut->tm_hour, ut->tm_min, (int) ut->tm_sec, ut->tm_year + 1900);
X
X return((char * )ctime_buf);
X}
X
END_OF_FILE
if test 887 -ne `wc -c <'ctime.c'`; then
echo shar: \"'ctime.c'\" unpacked with wrong size!
fi
# end of 'ctime.c'
fi
if test -f 'fclose.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'fclose.c'\"
else
echo shar: Extracting \"'fclose.c'\" \(956 characters\)
sed "s/^X//" >'fclose.c' <<'END_OF_FILE'
X/* fclose */
X/*
X * 4/1/88 changed by stefan brueck:
X */
X
X#include <errno.h>
X#include <file.h>
X#include "std-guts.h"
X
Xint fclose (f)
Xstruct file * f;
X{
X if (f) {
X int i;
X
X if (f->open_p) {
X if (((f->flags & 0x03) == O_WRONLY) ||
X ((f->flags & 0x03) == O_RDWR))
X {
X /* see if buffer needs flushing */
X int len = f->buf_max;
X if (len > 0)
X {
X /*
X * ..sb
X * jump to the place where this buffer came from
X */
X if (!isatty(f->handle))
X lseek (f->handle, f->file_position, 0);
X /*
X * now go on like before
X */
X write(f->handle, &f->buf, len);
X f->buf_index = f->buf_max = 0;
X }
X }
X if ((f->handle > 2) || (!isatty(f->handle)))
X close(f->handle);
X _remove_open_file(f);
X }
X }
X if (f && (f != stdin) && (f != stdout) && (f != stderr))
X free(f);
X
X return(0); /* really should check for err ... */
X}
END_OF_FILE
if test 956 -ne `wc -c <'fclose.c'`; then
echo shar: \"'fclose.c'\" unpacked with wrong size!
fi
# end of 'fclose.c'
fi
if test -f 'fflush.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'fflush.c'\"
else
echo shar: Extracting \"'fflush.c'\" \(1047 characters\)
sed "s/^X//" >'fflush.c' <<'END_OF_FILE'
X/* fflush */
X
X#include <file.h>
X#include "std-guts.h"
X
Xextern int _fflush_all_files();
X
Xint
Xfflush (f)
Xstruct file * f;
X{
X if (!f) return(_fflush_all_files());
X if (f->open_p &&
X (((f->flags & 0x03) == O_WRONLY) || ((f->flags & 0x03) == O_RDWR)))
X {
X int err = 0;
X int new_pos;
X int len = f->buf_max;
X
X if (len > 0)
X {
X if (f->flags & O_APPEND) {
X new_pos = lseek(f->handle, 0L, L_XTND);
X if (new_pos >= 0)
X f->file_position = new_pos;
X } else lseek(f->handle, f->file_position, L_SET);
X if (f->flags & O_DIRTY) {
X /* the dirty flag is cleared before write to avoid */
X /* loops if fflush gets recursively called by exit */
X /* if ^C is pressed during this write */
X f->flags &= ~O_DIRTY;
X err = _write_internal(f->handle, &f->buf, len,
X f->flags & FILE_BINARY_P);
X if (err < 0) {
X f->last_file_error = err;
X f->flags |= O_DIRTY;
X return (EOF);
X }
X }
X f->last_file_error = 0;
X }
X f->file_position += len;
X lseek(f->handle, f->file_position, L_SET);
X f->buf_index = f->buf_max = 0;
X }
X return(0);
X}
END_OF_FILE
if test 1047 -ne `wc -c <'fflush.c'`; then
echo shar: \"'fflush.c'\" unpacked with wrong size!
fi
# end of 'fflush.c'
fi
if test -f 'fopen.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'fopen.c'\"
else
echo shar: Extracting \"'fopen.c'\" \(795 characters\)
sed "s/^X//" >'fopen.c' <<'END_OF_FILE'
X/* fopen */
X
X#include <file.h>
X#include <errno.h>
X#include "std-guts.h"
X
Xstruct file * fopen (name, mode)
Xchar * name;
Xchar * mode;
X{
X int handle;
X struct file * f;
X int open_flags;
X
X open_flags = _parse_open_options(mode);
X handle = open (name, open_flags, 0664); /* try to open it */
X if (handle <= 0)
X {
X errno = -handle;
X return(NULL); /* couldn't open */
X }
X else
X {
X f = (struct file * )malloc(sizeof (struct file));
X f->handle = handle;
X f->open_p = 1;
X f->eof_p = 0;
X f->last_file_error = 0;
X f->flags = open_flags;
X f->buf_index = 0; /* so far... */
X f->buf_max = 0; /* nothing in buf yet */
X f->file_position = 0; /* nothing read yet */
X/* zzz should really check for file length here, for cases when we're
X appending... */
X
X _add_open_file(f);
X return(f);
X }
X
X}
END_OF_FILE
if test 795 -ne `wc -c <'fopen.c'`; then
echo shar: \"'fopen.c'\" unpacked with wrong size!
fi
# end of 'fopen.c'
fi
if test -f 'getwd.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'getwd.c'\"
else
echo shar: Extracting \"'getwd.c'\" \(661 characters\)
sed "s/^X//" >'getwd.c' <<'END_OF_FILE'
X/*
X * Cross Development System for Atari ST
X * Copyright (c) 1988, Memorial University of Newfoundland
X *
X * $Header: getwd.c,v 1.1 88/01/29 17:29:47 m68k Exp $
X *
X * $Log: getwd.c,v $
X * Revision 1.1 88/01/29 17:29:47 m68k
X * Initial revision
X *
X * jrd 1.2
X * initial ver was all fucked. re-wrote.
X *
X */
X#include <osbind.h>
X#include <string.h>
X#include <param.h>
X
Xchar *
Xgetwd(char *buf)
X{
X int rval;
X int drv;
X char *p;
X
X drv = Dgetdrv();
X if ((rval = Dgetpath(buf + 6, drv + 1)) < 0) {
X return (char *) 0;
X }
X strcpy(buf,"/dev/");
X buf[5] = drv + 'A';
X tos_to_unix(buf+6);
X
X return buf;
X}
X
Xchar *
Xgetcwd(char *buf)
X{
X return(getwd(buf));
X}
END_OF_FILE
if test 661 -ne `wc -c <'getwd.c'`; then
echo shar: \"'getwd.c'\" unpacked with wrong size!
fi
# end of 'getwd.c'
fi
if test -f 'include/ctype.h' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'include/ctype.h'\"
else
echo shar: Extracting \"'include/ctype.h'\" \(1052 characters\)
sed "s/^X//" >'include/ctype.h' <<'END_OF_FILE'
X/*
X * ctype.h
X *
X * Patterned after the Eunuchs one by jrd
X * 12/30/86
X *
X */
X
X /* upcase alphabetic */
X#define _U 01
X /* lowcase alpha */
X#define _L 02
X /* numeric */
X#define _N 04
X /* whitespace */
X#define _S 010
X /* printable */
X#define _P 020
X /* control */
X#define _C 040
X /* hex digit */
X#define _X 0100
X
Xextern char _ctype_[];
X
X#define isalpha(c) ((_ctype_)[c]&(_U|_L))
X#define isupper(c) ((_ctype_)[c]&_U)
X#define islower(c) ((_ctype_)[c]&_L)
X#define isdigit(c) ((_ctype_)[c]&_N)
X#define isxdigit(c) ((_ctype_)[c]&(_N|_X))
X#define isspace(c) ((_ctype_)[c]&_S)
X#define ispunct(c) ((_ctype_)[c]&_P)
X#define isalnum(c) ((_ctype_)[c]&(_U|_L|_N))
X#define isprint(c) ((_ctype_)[c]&(_P|_U|_L|_N))
X#define iscntrl(c) ((_ctype_)[c]&_C)
X#define isascii(c) ((unsigned)(c)<=0177)
X#define _toupper(c) ((c)-'a'+'A')
X#define _tolower(c) ((c)-'A'+'a')
X#define toascii(c) ((c)&0177)
X
Xstatic __inline int toupper(int c) { return (islower(c) ? _toupper(c) : c); }
Xstatic __inline int tolower(int c) { return (isupper(c) ? _tolower(c) : c); }
END_OF_FILE
if test 1052 -ne `wc -c <'include/ctype.h'`; then
echo shar: \"'include/ctype.h'\" unpacked with wrong size!
fi
# end of 'include/ctype.h'
fi
if test -f 'include/dir.h' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'include/dir.h'\"
else
echo shar: Extracting \"'include/dir.h'\" \(1362 characters\)
sed "s/^X//" >'include/dir.h' <<'END_OF_FILE'
X/*
X * Cross Development System for Atari ST
X * Copyright (c) 1988, Memorial University of Newfoundland
X *
X * A public domain implementation of BSD directory routines for
X * MS-DOS. Written by Michael Rendell ({uunet,utai}michael@garfield),
X * August 1897
X *
X * $Header: dir.h,v 1.1 88/01/29 17:22:25 m68k Exp $
X *
X * $Log: dir.h,v $
X * Revision 1.1 88/01/29 17:22:25 m68k
X * Initial revision
X *
X */
X#ifndef _DIR_H
X#define _DIR_H
X#ifndef _TYPES_H
X#include <types.h>
X#endif
X
X#define rewinddir(dirp) seekdir(dirp, 0L)
X
X#define MAXNAMLEN 12
X
Xstruct direct {
X ino_t d_ino; /* a bit of a farce */
X int d_reclen; /* more farce */
X int d_namlen; /* length of d_name */
X char d_name[MAXNAMLEN + 1]; /* garentee null termination */
X};
X
Xstruct _dircontents {
X char *_d_entry;
X struct _dircontents *_d_next;
X u_short _d_date;
X u_short _d_time;
X char _d_attr;
X long _d_size;
X};
X
Xtypedef struct _dirdesc {
X int dd_id; /* uniquely identify each open directory */
X long dd_loc; /* where we are in directory entry is this */
X struct _dircontents *dd_contents; /* pointer to contents of dir */
X struct _dircontents *dd_cp; /* pointer to current position */
X char *dd_name;
X struct _dirdesc *dd_next;
X} DIR;
X
Xextern DIR *opendir();
Xextern struct direct *readdir();
Xextern void seekdir();
Xextern long telldir();
Xextern void closedir();
X#endif /* _DIR_H */
END_OF_FILE
if test 1362 -ne `wc -c <'include/dir.h'`; then
echo shar: \"'include/dir.h'\" unpacked with wrong size!
fi
# end of 'include/dir.h'
fi
if test -f 'include/fcntl.h' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'include/fcntl.h'\"
else
echo shar: Extracting \"'include/fcntl.h'\" \(988 characters\)
sed "s/^X//" >'include/fcntl.h' <<'END_OF_FILE'
X#ifndef _FCNTL_H
X#define _FCNTL_H
X
X#define O_RDONLY 0
X#define O_WRONLY 1
X#define O_RDWR 2
X#define O_NDELAY 04 /* Non-blocking I/O */
X#define O_APPEND 010 /* append (writes guaranteed at the end) */
X#define O_SYNC 020 /* synchronous write option */
X#define O_DIRTY 0200 /* buffer was changed (needs flushing) */
X
X#define O_CREAT 00400 /* create file (uses third open arg) */
X#define O_TRUNC 01000 /* truncate file */
X#define O_EXCL 02000 /* exclusive open */
X
X#define FILE_BINARY_P 040 /* file opened for binary access */
X#define FILE_FLUSH_P 0100
X
X#define F_DUPFD 0 /* Duplicate fildes */
X#define F_GETFD 1 /* Get fildes flags */
X#define F_SETFD 2 /* Set fildes flags */
X#define F_GETFL 3 /* Get file flags */
X#define F_SETFL 4 /* Set file flags */
X#define F_GETLK 5 /* Get file lock */
X#define F_SETLK 6 /* Set file lock */
X#define F_SETLKW 7 /* Set file lock and wait */
X
X#define F_RDLCK 1
X#define F_WRLCK 2
X#define F_UNLCK 3
X
Xextern int fcntl (int, int, int);
X
X#endif
END_OF_FILE
if test 988 -ne `wc -c <'include/fcntl.h'`; then
echo shar: \"'include/fcntl.h'\" unpacked with wrong size!
fi
# end of 'include/fcntl.h'
fi
if test -f 'include/file.h' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'include/file.h'\"
else
echo shar: Extracting \"'include/file.h'\" \(692 characters\)
sed "s/^X//" >'include/file.h' <<'END_OF_FILE'
X/*
X * Cross Development System for Atari ST
X * Copyright (c) 1988, Memorial University of Newfoundland
X *
X * $Header: file.h,v 1.1 88/01/29 17:22:27 m68k Exp $
X *
X * $Log: file.h,v $
X * Revision 1.1 88/01/29 17:22:27 m68k
X * Initial revision
X *
X */
X
X#ifndef FILE_H
X#define FILE_H
X/*
X * open
X */
X
X#include <fcntl.h>
X
X/*
X * access
X */
X#define F_OK 0
X#define X_OK 1
X#define W_OK 2
X#define R_OK 4
X
X/*
X * lseek
X */
X#define L_SET 0
X#define L_INCR 1
X#define L_XTND 2
X
X/* defs for handle frob */
X
X#define N_HANDLES 64
X
Xextern char __handle_stat[];
Xextern char *__handle_to_name[];
X
X#define FH_UNKNOWN 0
X#define FH_ISATTY 1
X#define FH_ISAFILE 2
X
X/* maybe more later */
X#endif
END_OF_FILE
if test 692 -ne `wc -c <'include/file.h'`; then
echo shar: \"'include/file.h'\" unpacked with wrong size!
fi
# end of 'include/file.h'
fi
if test -f 'include/ioctl.h' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'include/ioctl.h'\"
else
echo shar: Extracting \"'include/ioctl.h'\" \(1572 characters\)
sed "s/^X//" >'include/ioctl.h' <<'END_OF_FILE'
X/*
X * Cross Development System for Atari ST
X * Copyright (c) 1988, Memorial University of Newfoundland
X *
X * Some fields in these structures are igored, like the t_suspc/dsuspc and
X * t_startc/stopc and t_flushc. Should add an extra field somewhere for
X * an extra erase character so both ^H and ^? would work.
X *
X * $Header: ioctl.h,v 1.1 88/02/03 20:14:16 m68k Exp $
X *
X * $Log: ioctl.h,v $
X * Revision 1.1 88/02/03 20:14:16 m68k
X * Initial revision
X *
X */
X#ifndef _IOCTL_
X# define _IOCTL_
X
X#define TIOCGETP 0x0000 /* sgttyb */
X#define TIOCSETP 0x0001
X#define TIOCGETC 0x0002 /* tchars */
X#define TIOCSETC 0x0003
X#define TIOCGLTC 0x0004 /* ltchars */
X#define TIOCSLTC 0x0005
X#define TIOCSETN 0x0006 /* used in emacs, is this ok ? */
X
Xstruct tchars {
X char t_intrc;
X char t_quitc;
X char t_startc;
X char t_stopc;
X char t_eofc;
X char t_brkc;
X};
X
Xstruct ltchars {
X char t_suspc;
X char t_dsuspc;
X char t_rprntc;
X char t_flushc;
X char t_werasc;
X char t_lnextc;
X};
X
X#define CRMOD 0x0001
X#define CBREAK 0x0002
X#define ECHO 0x0004
X#define XTABS 0x0008
X#define RAW 0x0010
X#define LCASE 0x0000 /* does nothing (and never will!) */
X#define TANDEM 0x0000 /* not needed */
X#define META 0x0100 /* extension: Alternate as meta key */
X
X/* Only ones that are likely to be used are here */
X#define B300 0
X#define B1200 1
X#define B2400 2
X#define B4800 3
X#define B9600 4
X
X#define ANYP (B300|B1200|B2400|B4800|B9600)
X#define ALLDELAY 0
X
Xstruct sgttyb {
X char sg_ispeed;
X char sg_ospeed;
X char sg_erase;
X char sg_kill;
X short sg_flags;
X};
X#endif /* _IOCTL_ */
END_OF_FILE
if test 1572 -ne `wc -c <'include/ioctl.h'`; then
echo shar: \"'include/ioctl.h'\" unpacked with wrong size!
fi
# end of 'include/ioctl.h'
fi
if test -f 'include/siglist.h' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'include/siglist.h'\"
else
echo shar: Extracting \"'include/siglist.h'\" \(706 characters\)
sed "s/^X//" >'include/siglist.h' <<'END_OF_FILE'
X/* This file was produced by running make_siglist. Don't edit. */
X
Xchar *sys_siglist[] = {
X "No signal",
X "Alarm clock",
X "Segmentation violation",
X "Signal 3",
X "Illegal instruction",
X "Signal 5",
X "Signal 6",
X "Trace trap",
X "Signal 8",
X "Signal 9",
X "Interrupt",
X "Quit",
X "Stopped from keyboard",
X "Floating point exception",
X "Hangup",
X "Abnormal termination",
X "Software termination",
X "User defined signal 1",
X "User defined signal 2"
X};
X
Xchar *signal_names[] = {
X "ON_EXIT",
X "SIGALRM",
X "SIGSEGV",
X "0",
X "SIGILL",
X "0",
X "0",
X "SIGTRAP",
X "0",
X "0",
X "SIGINT",
X "SIGQUIT",
X "SIGTSTP",
X "SIGFPE",
X "SIGHUP",
X "SIGABRT",
X "SIGTERM",
X "SIGUSR1",
X "SIGUSR2"
X};
END_OF_FILE
if test 706 -ne `wc -c <'include/siglist.h'`; then
echo shar: \"'include/siglist.h'\" unpacked with wrong size!
fi
# end of 'include/siglist.h'
fi
if test -f 'include/sysvars.h' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'include/sysvars.h'\"
else
echo shar: Extracting \"'include/sysvars.h'\" \(843 characters\)
sed "s/^X//" >'include/sysvars.h' <<'END_OF_FILE'
X/*
X * Cross Development System for Atari ST
X * Copyright (c) 1988, Memorial University of Newfoundland
X *
X * Addresses of system variables (these are the ones "cast in stone") -
X * add them as you need them.
X *
X * $Header: sysvars.h,v 1.2 88/02/03 22:30:14 m68k Exp $
X *
X * $Log: sysvars.h,v $
X * Revision 1.2 88/02/03 22:30:14 m68k
X * Set the high bit in address <64k - this avoids a problem (in 68k chip?)
X * that causes things not to work (movl 1212:w, d0 does not work as expected).
X *
X * Revision 1.1 88/02/03 20:04:48 m68k
X * Initial revision
X *
X */
X#define nvblq ((short *) 0x80000454)
X/* This should be pointer to ponter to function returning int but C doesn't
X * like dealing with such things
X */
X#define _vblqueue ((char ***) 0x80000456)
X#define _hz_200 ((long *) 0x800004bA)
X#define conterm ((char *) 0x80000484)
END_OF_FILE
if test 843 -ne `wc -c <'include/sysvars.h'`; then
echo shar: \"'include/sysvars.h'\" unpacked with wrong size!
fi
# end of 'include/sysvars.h'
fi
if test -f 'include/tchars.h' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'include/tchars.h'\"
else
echo shar: Extracting \"'include/tchars.h'\" \(772 characters\)
sed "s/^X//" >'include/tchars.h' <<'END_OF_FILE'
X/*
X * Cross Development System for Atari ST
X * Copyright (c) 1988, Memorial University of Newfoundland
X *
X * The TC defines are indices into the __tchars array.
X *
X * $Header: tchars.h,v 1.1 88/02/03 22:58:50 m68k Exp $
X *
X * $Log: tchars.h,v $
X * Revision 1.1 88/02/03 22:58:50 m68k
X * Initial revision
X *
X */
X#define TC_ERASE 0
X#define TC_KILL 1
X#define TC_INTRC 2
X#define TC_QUITC 3
X#define TC_EOFC 4
X#define TC_BRKC 5
X#define TC_RPRNTC 6
X#define TC_WERASC 7
X#define TC_LNEXTC 8
X#define TC_RUBOUT 9
X#define TC_SUSPC 10
X#define TC_DSUSPC 11
X#define TC_FLUSHC 12
X#define TC_UNDEF -1
X
Xtypedef struct {
X unsigned char *unshift;
X unsigned char *shift;
X unsigned char *capslock;
X} KEYTAB;
X
Xextern char __tchars[];
Xextern int __ttymode;
Xextern KEYTAB *__keytab;
END_OF_FILE
if test 772 -ne `wc -c <'include/tchars.h'`; then
echo shar: \"'include/tchars.h'\" unpacked with wrong size!
fi
# end of 'include/tchars.h'
fi
if test -f 'isatty.c.cdiff' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'isatty.c.cdiff'\"
else
echo shar: Extracting \"'isatty.c.cdiff'\" \(964 characters\)
sed "s/^X//" >'isatty.c.cdiff' <<'END_OF_FILE'
X*** terminator/isatty.c Fri Aug 11 18:52:27 1989
X--- new-lib/isatty.c Sat Jan 14 08:24:40 1989
X***************
X*** 13,14 ****
X--- 13,15 ----
X
X+ if (handle == 1234) return(0); /* /dev/null */
X if (handle < 0)
X***************
X*** 17,19 ****
X if (__handle_stat[handle] != FH_UNKNOWN)
X! return(__handle_stat[handle] == FH_ISATTY);
X oldloc = Fseek (0L, handle, L_INCR); /* seek zero bytes from current loc */
X--- 18,20 ----
X if (__handle_stat[handle] != FH_UNKNOWN)
X! return(__handle_stat[handle] & FH_ISATTY);
X oldloc = Fseek (0L, handle, L_INCR); /* seek zero bytes from current loc */
X***************
X*** 33,37 ****
X if (rc)
X! __handle_stat[handle] = FH_ISATTY;
X else
X! __handle_stat[handle] = FH_ISAFILE;
X return (rc); /* return true, false, or error */
X--- 34,38 ----
X if (rc)
X! __handle_stat[handle] |= FH_ISATTY;
X else
X! __handle_stat[handle] |= FH_ISAFILE;
X return (rc); /* return true, false, or error */
END_OF_FILE
if test 964 -ne `wc -c <'isatty.c.cdiff'`; then
echo shar: \"'isatty.c.cdiff'\" unpacked with wrong size!
fi
# end of 'isatty.c.cdiff'
fi
if test -f 'localtim.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'localtim.c'\"
else
echo shar: Extracting \"'localtim.c'\" \(1372 characters\)
sed "s/^X//" >'localtim.c' <<'END_OF_FILE'
X/*
X * struct tm *localtime (zeiger auf(sec seit 1.1.1970 0.00 GMT))
X * die anzahl der sekunden liefert normalerweise time()
X *
X * bsp:
X * #include <time.h>
X * long p;
X * struct tm *ut;
X * time(&p);
X * ut = localtime(&p);
X *
X * rueckgabe: ein zeiger auf eine struktur gemaess time.h
X *
X * stefan brueck 4/1/89
X */
X
X#include <time.h>
X
Xchar day_in_month[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
X
Xstruct tm * localtime(const time_t *const date_and_time)
X{
X static struct tm _tm;
X int month, year;
X long day, sec;
X int days_in_year;
X
X day = (long) (*date_and_time / 86400L);
X _tm.tm_wday = (int) ((day + 4) % 7);
X sec = *date_and_time - (day * 86400L);
X day++;
X for ( year = 0 ; 1 ; year++)
X {
X if ((year + 2) % 4)
X days_in_year = 365;
X else
X days_in_year = 366;
X
X if (day - days_in_year <= 0)
X break;
X day -= days_in_year;
X }
X
X _tm.tm_year = year + 70;
X _tm.tm_yday = (int) day;
X
X if (!((year + 2) % 4))
X day_in_month[2] = (char) 29;
X else
X day_in_month[2] = (char) 28;
X
X for ( month = 1 ; month < 13 ; month++)
X {
X if (day - (long) day_in_month[month] <= 0)
X break;
X day -= (long) day_in_month[month];
X }
X
X _tm.tm_hour = (int) (sec / 3600L);
X sec -= _tm.tm_hour * 3600L;
X _tm.tm_min = (int) (sec / 60L);
X sec -= _tm.tm_min * 60L;
X
X _tm.tm_mon = month - 1;
X _tm.tm_mday = day;
X _tm.tm_sec = sec;
X _tm.tm_isdst = 0;
X
X return (&_tm);
X}
END_OF_FILE
if test 1372 -ne `wc -c <'localtim.c'`; then
echo shar: \"'localtim.c'\" unpacked with wrong size!
fi
# end of 'localtim.c'
fi
if test -f 'pause.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'pause.c'\"
else
echo shar: Extracting \"'pause.c'\" \(795 characters\)
sed "s/^X//" >'pause.c' <<'END_OF_FILE'
X/*
X * Cross Development System for Atari ST
X *
X * $Header: pause.c,v 1.0 89/01/11 00:31:30 m68k Exp $
X *
X * $Log: pause.c,v $
X *
X * 1.0 er
X *
X * Revision 1.0 89/01/11 00:31:30 m68k
X * Initial revision
X *
X */
X/* #include <gembios.h> ?? */
X#include <osbind.h>
X#include <ioctl.h>
X#include <signal.h>
X#include "tchars.h"
X
Xextern volatile char _sig_done; /* defined in signal.c */
X
X/* pause waits forever or until a signal comes in */
Xvoid
Xpause()
X{
X char c;
X
X _sig_done = 0;
X while(!_sig_done) {
X if (Cconis()) {
X c = Crawcin() & 0xff;
X if ((__ttymode & META) && (Kbshift(-1) & 8)) c |= 0x80;
X if (__ttymode & RAW) continue;
X if ((__ttymode & CRMOD) && c == '\r') c = '\n';
X if (c == __tchars[TC_INTRC]) raise(SIGINT);
X else if (c == __tchars[TC_QUITC]) raise(SIGQUIT);
X }
X }
X}
END_OF_FILE
if test 795 -ne `wc -c <'pause.c'`; then
echo shar: \"'pause.c'\" unpacked with wrong size!
fi
# end of 'pause.c'
fi
if test -f 'sfguts.c.cdiff' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'sfguts.c.cdiff'\"
else
echo shar: Extracting \"'sfguts.c.cdiff'\" \(685 characters\)
sed "s/^X//" >'sfguts.c.cdiff' <<'END_OF_FILE'
X*** terminator/sfguts.c Fri Aug 11 18:52:57 1989
X--- new-lib/sfguts.c Wed Aug 16 19:07:02 1989
X***************
X*** 1,2 ****
X!
X /* this version borrowed from Dlibs, and bug-fixed a bit by jrd */
X--- 1,2 ----
X! /* er: added %n format to get more ANSI compatibility */
X /* this version borrowed from Dlibs, and bug-fixed a bit by jrd */
X***************
X*** 6,7 ****
X--- 6,10 ----
X
X+ #define TRUE (1)
X+ #define FALSE (0)
X+
X /* #define skip() do{c=(*get)(ip); if (c<1) goto done;}while(isspace(c))*/
X***************
X*** 242,243 ****
X--- 245,253 ----
X }
X+ break;
X+
X+ case 'n':
X+ if (store) {
X+ p = *args;
X+ *((int *) p) = cnt;
X+ }
X break;
END_OF_FILE
if test 685 -ne `wc -c <'sfguts.c.cdiff'`; then
echo shar: \"'sfguts.c.cdiff'\" unpacked with wrong size!
fi
# end of 'sfguts.c.cdiff'
fi
if test -f 'std-guts.h' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'std-guts.h'\"
else
echo shar: Extracting \"'std-guts.h'\" \(1045 characters\)
sed "s/^X//" >'std-guts.h' <<'END_OF_FILE'
X
X/* internal structure defs for FILE structs and the code that hacks on them */
X
X/* buffer size */
X
X#define BUFSIZE 1024
X
Xstruct file
X {
X unsigned char open_p; /* 1-> this one's open */
X unsigned char eof_p; /* 1-> at eof */
X unsigned char flags; /* read and write mode bits */
X unsigned char slush;
X unsigned short handle; /* the file_handle GEMDOS gave us */
X short buf_index; /* idx into buf; signed cause it can be
X -1 when somebody ungetcs something */
X short buf_max; /* end of valid data in buf */
X unsigned long file_position; /* nbytes into file of buf */
X int last_file_error; /* last error encountered */
X short unchar_slush; /* in case we unchar at begin buf */
X char buf[BUFSIZE]; /* and the buffer */
X };
X
X#define file_output_p(f) \
X (((f->flags & 0x03) == O_WRONLY) || ((f->flags & 0x03) == O_RDWR))
X
X#define file_input_p(f) \
X (((f->flags & 0x03) == O_RDONLY) || ((f->flags & 0x03) == O_RDWR))
X
X#define EOF -1
X#define NULL 0
X
Xextern struct file * stdin;
Xextern struct file * stdout;
Xextern struct file * stderr;
END_OF_FILE
if test 1045 -ne `wc -c <'std-guts.h'`; then
echo shar: \"'std-guts.h'\" unpacked with wrong size!
fi
# end of 'std-guts.h'
fi
if test -f 'strstr.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'strstr.c'\"
else
echo shar: Extracting \"'strstr.c'\" \(1127 characters\)
sed "s/^X//" >'strstr.c' <<'END_OF_FILE'
X/*
X * strstr() - sucht in dem string s2 den string s1
X * rueckgabe ist entweder ein zeiger auf das erste
X * vorkommen vom ersten zeichen von s1 in s2, falls
X * s1 in s2 vorhanden ist, oder NULL, falls s1 in
X * s2 nicht vorhanden ist oder einer der beiden strings
X * ein zeiger auf '\0' ist.
X *
X * stefan brueck 11/88
X * diese source ist frei von jedem copyright.
X */
X
X#define NULL (char *) 0L
X
Xchar * strstr(s1,s2)
Xchar * s1;
Xchar * s2;
X{
X register char *scan1;
X register char *scan2;
X
X if (!(s1 == NULL || s2 == NULL))
X {
X if (*s2 && *s1)
X for (scan2 = s2 ; *scan2 ; scan2 = ++s2)
X {
X for (scan1 = s1; *scan1 ; scan1++)
X {
X if (*scan1 != *scan2 || !*scan2)
X break;
X scan2++;
X }
X
X /* der zu suchende string liegt komplett in
X * dem zu testenden string drin -> gefundene
X * position zurueckgeben
X */
X if (!*scan1)
X return (s2);
X
X /* wenn nicht, dann weitersuchen beim naechsten
X * buchstaben des zu testendem strings, bis entweder
X * was gefunden wurde, oder das ende vom zu durchsuchenden
X * string erreicht wurde.
X */
X }
X }
X return (NULL);
X}
X
END_OF_FILE
if test 1127 -ne `wc -c <'strstr.c'`; then
echo shar: \"'strstr.c'\" unpacked with wrong size!
fi
# end of 'strstr.c'
fi
if test -f 'tchars.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'tchars.c'\"
else
echo shar: Extracting \"'tchars.c'\" \(858 characters\)
sed "s/^X//" >'tchars.c' <<'END_OF_FILE'
X/*
X * Cross Development System for Atari ST
X * Copyright (c) 1988, Memorial University of Newfoundland
X *
X * These to keep track of the current special characters and tty mode.
X *
X * $Header: tchars.c,v 1.1 88/02/03 22:58:46 m68k Exp $
X *
X * $Log: tchars.c,v $
X * Revision 1.1 88/02/03 22:58:46 m68k
X * Initial revision
X *
X */
X#include <ioctl.h>
X#include "tchars.h"
X
Xint __ttymode = CRMOD|ECHO|XTABS;
Xchar __tchars[13] = {
X 010, /* TC_ERASE - ^H */
X 025, /* TC_KILL - ^U */
X 003, /* TC_INTRC - ^C */
X 034, /* TC_QUITC - ^\ */
X 004, /* TC_EOFC - ^D */
X TC_UNDEF, /* TC_BRKC - undefined */
X 022, /* TC_RPRNTC - ^R */
X 027, /* TC_WREASC - ^W */
X 026, /* TC_LNEXTC - ^V */
X 0177, /* TC_RUBOUT - RUB */
X 032, /* TC_SUSP - ^Z */
X 031, /* TC_DSUSP - ^Y */
X TC_UNDEF /* TC_FLUSHC - undefined */
X };
XKEYTAB *__keytab;
END_OF_FILE
if test 858 -ne `wc -c <'tchars.c'`; then
echo shar: \"'tchars.c'\" unpacked with wrong size!
fi
# end of 'tchars.c'
fi
if test -f 'trap-14.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'trap-14.c'\"
else
echo shar: Extracting \"'trap-14.c'\" \(1472 characters\)
sed "s/^X//" >'trap-14.c' <<'END_OF_FILE'
X
X/* xbios trap */
X
Xtrap_14_wwll(w1, w2, l1, l2)
Xlong w1, w2, l1, l2;
X{
X asm("moveml #0x3FFC,sp@-");
X asm("movel a6@(20),sp@-");
X asm("movel a6@(16),sp@-");
X asm("movel a6@(12),d0");
X asm("movew d0,sp@-");
X asm("movel a6@(8),d0");
X asm("movew d0,sp@-");
X asm("bset #0, __in_trap");
X asm("trap #14");
X asm("bclr #0, __in_trap");
X asm("addl #12,sp");
X asm("moveml sp@+,#0x3FFC");
X}
X
Xtrap_14_wllw(w1, l1, l2, w2)
Xlong w1, l1, l2, w2;
X{
X asm("moveml #0x3FFC,sp@-");
X asm("movel a6@(20),d0");
X asm("movew d0,sp@-");
X asm("movel a6@(16),sp@-");
X asm("movel a6@(12),sp@-");
X asm("movel a6@(8),d0");
X asm("movew d0,sp@-");
X asm("bset #0, __in_trap");
X asm("trap #14");
X asm("bclr #0, __in_trap");
X asm("addl #12,sp");
X asm("moveml sp@+,#0x3FFC");
X}
X
Xtrap_14_wlll(w1, l1, l2, l3)
Xlong w1, l1, l2, l3;
X{
X asm("moveml #0x3FFC,sp@-");
X asm("movel a6@(20),sp@-");
X asm("movel a6@(16),sp@-");
X asm("movel a6@(12),sp@-");
X asm("movel a6@(8),d0");
X asm("movew d0,sp@-");
X asm("bset #0, __in_trap");
X asm("trap #14");
X asm("bclr #0, __in_trap");
X asm("addl #14,sp");
X asm("moveml sp@+,#0x3FFC");
X}
X
Xtrap_14_www(w1, w2, w3)
Xlong w1, w2, w3;
X{
X asm("moveml #0x3FFC,sp@-");
X asm("movel a6@(16),d0");
X asm("movew d0,sp@-");
X asm("movel a6@(12),d0");
X asm("movew d0,sp@-");
X asm("movel a6@(8),d0");
X asm("movew d0,sp@-");
X asm("bset #0, __in_trap");
X asm("trap #14");
X asm("bclr #0, __in_trap");
X asm("addl #6,sp");
X asm("moveml sp@+,#0x3FFC");
X}
X
END_OF_FILE
if test 1472 -ne `wc -c <'trap-14.c'`; then
echo shar: \"'trap-14.c'\" unpacked with wrong size!
fi
# end of 'trap-14.c'
fi
echo shar: End of archive 2 \(of 7\).
cp /dev/null ark2isdone
MISSING=""
for I in 1 2 3 4 5 6 7 ; do
if test ! -f ark${I}isdone ; then
MISSING="${MISSING} ${I}"
fi
done
if test "${MISSING}" = "" ; then
echo You have unpacked all 7 archives.
rm -f ark[1-9]isdone
else
echo You still need to unpack the following archives:
echo " " ${MISSING}
fi
## End of shell archive.
exit 0