%%%%%%%%%%%%%%%%%%%%%%%%%%%% -*- Mode: TeX -*- %%%%%%%%%%%%%%%%%%%%%%%%%%
%% lib-card.tex -- Reference Card for Atari ST GNU C Library Functions
%%		   This file is to be processed by plain TeX.
%%
%% Copyright (C) 1990,1991	Frank Ridderbusch
%%
%% This text is free software; you can redistribute it and/or modify
%% it under the terms of the GNU General Public License as published by
%% the Free Software Foundation; either version 1, or any later version.
%% 
%% This program (text) is distributed in the hope that it will be useful,
%% but WITHOUT ANY WARRANTY; without even the implied warranty of
%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
%% GNU General Public License for more details.
%% 
%% Additional, I declare this reference card postcardware. If you find
%% this reference card usefull, please send a simple postcard to the
%% address mentioned below.
%%
%% Author          : Frank Ridderbusch
%% Created On      : Mon Mar 12 10:55:38 1990
%% Last Modified By: Frank Ridderbusch
%% Last Modified On: Sun May 19 13:10:00 1991
%% Update Count    : 114
%% Status          : Released.
%% COMMENTS
%%    The mathematical function section could take some additional
%%    explanations, but then I'm afraid I've to fill another complete
%%    page (12 pages aka 24 columns is quite enough). Also some
%%    functions in the signals section are missing a explanation. The
%%    motivation behind this routines is not 100% clear to me. For
%%    additonal hints about this multicolumn format see the comment in
%%    the file varmacro.tex.
%% HISTORY 
%% 18-May-1991		Frank Ridderbusch	
%%    Last Modified: Sat May 18 13:09:22 1991 #110 (nil)
%%    Updated to match J.R.Bammi's recent sent diffs. Inclusion of
%%    MiNT and TT stuff. (Libraries and headers at patchlevel 65)
%% 2-May-1991		Frank Ridderbusch T35	
%%    Now uses varmacro.tex for all macros. Definitions from this file
%%    have been moved to that file. Now using \function instead of
%%    \func and \lfunc.
%% 16-Nov-1990		Frank Ridderbusch
%%    Got 3 columns format working and new include presentation
%%  2-May-1990		Frank Ridderbusch
%%    Fiddling with the format and insertation of sysvars
%%  1-May-1990		Frank Ridderbusch
%%    Inserting remarks about fgets and gets concerning the NL character.
%% 29-Apr-1990		Frank Ridderbusch
%%    Including the vt52 escape sequences
%% 24-Apr-1990		Jwahar R. Bammi
%%    Corrections & additional functions (linea, lstat, profiling, etc)
%% 11-Mar-1990          Frank Ridderbusch
%%    Starting point. Creating macros \func. \lfunc and \expl.
%%
%%    Please send any comments about missing features or things to
%%    include to:
%%    Email:
%%	ridderbusch.kd@sni-usa.com (America (North & South))
%%      ridderbusch.kd@sni.de      (Rest of World)
%%
%%    Snail:
%%	Frank Ridderbusch	Tel.: (049)-5254 67066
%%	Sander Str. 17
%%	W-4790 Paderborn
%%	Germany
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Reference Card for GNU C Library on the Atari ST
%**start of header
\newcount\columnsperpage

% This file can be printed with 1, 2, or 3 columns per page (see below).
% Specify how many you want here.  Nothing else needs to be changed.

\columnsperpage=2

\def\versionnumber{2.0}
\def\year{1991}
\def\version{May \year\ v\versionnumber}

\def\shortcopyrightnotice{\vskip 1ex plus 2 fill
  \centerline{\small \copyright\ \year\ Frank Ridderbusch
  Permissions on back.  v\versionnumber}}

\def\copyrightnotice{
\vskip 1ex plus 2 fill\begingroup\small
\centerline{Copyright \copyright\ \year\ Frank Ridderbusch}
\centerline{This multicolumn format was originally designed}
\centerline{by Stephen Gildea and modified to fit the Atari ST}
\centerline{library functions by Frank Ridderbusch}

Permission is granted to make and distribute copies of
this card provided the copyright notice and this permission notice
are preserved on all copies.

\endgroup}

\input varmacro

\overfullrule=0pt % avoid ugly black boxes

%**end of header

\title{Tos--GNU C Library Functions}

This reference card describes the available library functions of GNU C
on the Atari ST and is currently based on the library from
Jwahar~R. Bammi at patchlevel 65. For the most part the functions
are alphabetically sorted by function name.

Some of the mentioned functions are only available, when MiNT, the TOS
multitasking extension from Eric~R. Smith is running, or if you
have a TT\null.  The earlier are marked with ``(MiNT)'', the latter with
``(TT)''.\par
\medskip
\rewritetocfilefalse
\readtocfile
\medskip
Additionally, this reference card is postcardware. If you find it
usefull, send a postcard to this address: Frank Ridderbusch, Sander
Str.~17, W-4790~Paderborn, Germany.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\section{Standard I/O}

\#include \<stdio.h>

{\leftskip=\myindent The following aliases for some of the below
functions are defined.\par}

\beginindentedkeys
\paralign to \hsize{#\tabskip=10pt plus 1 fil\hfil&#\hfil\cr
  \twocol{getc}{fgetc}
  \twocol{ungetc}{fungetc}
  \twocol{putc}{fputc}
  \twocol{getchar()}{fgetc(stdin)}
  \twocol{ungetchar(c)}{fungetc((c),stdin)}
  \twocol{putchar(c)}{fputc((c),stdout)}
}\endindentedkeys

\function{void clearerr(FILE \*fp);}
\expl{Clear error and EOF status of stream {\sl fp}. (Macro)}

\function{int fclose(FILE \*fp);}
\expl{Close the stream {\sl fp}.}

\function{FILE \*fdopen(int fd, const~char \*mode);}
\expl{Connect a filepointer to the filedescriptor {\sl fd} with mode
{\sl mode}.}

\function{int feof(FILE \*fp);}
\expl{Test EOF status of stream {\sl fp}. (Macro)}

\function{int ferror(FILE \*fp);}
\expl{Test error status of stream {\sl fp}. (Macro)}

\function{int fflush(FILE \*fp);}
\expl{Write data from internal buffer of stream {\sl fp} to the file.}

\function{int fgetc(FILE \*fp);}
\expl{Get a character from stream {\sl fp}.}

\function{int fgetpos(FILE \*fp, fpos\_t \*ptr);}
\expl{Put the current position of the filepointer of stream {\sl fp}
into the address {\sl ptr}.}

\function{char \*fgets(char \*buf, int max, FILE \*fp);}
\expl{Get a string including the NL character from stream {\sl fp}
with {\sl max} byte into {\sl buf}.}

\function{int fileno(FILE \*fp);}
\expl{Get filedescriptor of stream {\sl fp}. (Macro)}

\function{FILE \*fopen(const~char \*fname, const~char \*mode);}
\expl{Open file {\sl fname} with mode {\sl mode} for stream I/O.}

\function{int fputc(int c, FILE \*fp);}
\expl{Write a character {\sl c} into stream {\sl fp}.}

\function{int fputs(const~char \*buf, FILE \*fp);}
\expl{Write the string in {\sl buf} into stream {\sl fp}.}

\function{size\_t fread(void \*buf, size\_t sz, size\_t no, FILE \*fp);}
\expl{Read {\sl no} items of size {\sl sz} from stream {\sl fp} into 
{\sl buf}.}

\function{FILE \*freopen(const~char \*fname, const~char \*mode, FILE \*fp);}
\expl{Reopen {\sl fp} with file {\sl fname} and mode {\sl mode}.}

\function{int fseek(FILE \*fp, long pos, int whence);}
\expl{Move the the filepointer from stream {\sl fp} to position {\sl pos}
relativ to {\sl whence}.}

\function{int fsetpos(FILE \*fp, fpos\_t \*ptr);}
\expl{Set the position of the filepointer of stream {\sl fp} to the
value at address {\sl ptr}.}

\function{long ftell(FILE \*fp);}
\expl{Get the current position of the filepointer from stream {\sl fp}.}

\function{int fungetc(int c, FILE \*fp);}
\expl{Push the character {\sl c} back onto stream {\sl fp}.}

\function{size\_t fwrite(const~void \*buf, size\_t size, size\_t no , FILE \*fp);}
\expl{Write {\sl no} items of size {\sl sz} from {\sl buf} into stream
{\sl fp}.}

\function{long getl(FILE \*fp);}
\expl{Read a long value from stream {\sl fp}.}

\function{char \*gets(char \*buf);}
\expl{Get a string from \<stdin> into {\sl buf}. The NL character is 
discarded.}

\function{short getw(FILE \*fp);}
\expl{Read a short value from stream {\sl fp}.}

\function{int pclose(FILE \*fp);}
\expl{Close the stream created by {\bf popen()}.}

\function{void perror(const~char \*str);}
\expl{Display error message starting with {\sl str} depending on {\sl
errno}.}

\function{FILE \*popen(const~char \*command, const~char \*mode);}
\expl{Open a pipe with {\sl mode} to {\sl command}. (Faked by temporary
files)}

\function{int printf(const~char \*fmt, $\ldots$);}
\function{int fprintf(FILE \*fp, const~char \*fmt, $\ldots$);}
\function{int sprintf(char \*buf, const~char \*fmt, $\ldots$);}
\function{int vprintf(const~char \*fmt, char \*);}
\function{int vfprintf(FILE \*fp, const~char \*fmt, char \*);}
\function{int vsprintf(char \*buf, const~char \*fmt, char \*);}
\expl{Formated output to either \<stdout>, {\sl fp} or {\sl buf} with fixed 
or variable number of arguments.}

{\leftskip=\myindent The following table lists the identifying letters of
the {\sl fmt} string.\par}

\beginindentedkeys\beginthreecolumn
  \threecolrule{scanf}{printf}{Meaning}
  \noalign{\hrule}
  \threecolrule{d}{d,i}{Decimal number}
  \threecolrule{o}{o}{Octal number}
  \threecolrule{x}{x,X}{Hexadecimal number}
  \threecolrule{u}{u}{Unsigned decimal n.}
  \threecolrule{b}{\omit}{Unsigned binary int.}
  \threecolrule{i}{\omit}{Any base num.}
  \threecolrule{D}{D}{Long Decimal number}
  \threecolrule{O}{O}{Long Octal number}
  \threecolrule{U}{U}{Unsigned long decimal}
  \threecolrule{X}{\omit}{Long Hexadecimal}
  \threecolrule{ld,lo,lx}{ld,li,lo,lx,lX}{Long $\ldots$ number}
  \threecolrule{lb}{\omit}{Unsigned binary long}
  \threecolrule{li}{\omit}{Any base num. long}
  \threecolrule{hd,ho,hx}{d,o,x,X}{Short $\ldots$ number}
  \threecolrule{c}{c}{Character}
  \threecolrule{s}{s}{String}
  \threecolrule{\omit}{p}{Pointer}
  \threecolrule{[$\ldots$]}{\omit}{Str. consist. of char.}
  \threecolrule{e,f,g}{f}{Fixed-point number}
  \threecolrule{e,f,g}{e,E}{Floating-point number}
  \threecolrule{le,lf,lg}{\omit}{Double prec. $\ldots$ n.}
  \threecolrule{E,F,G}{\omit}{Double prec. $\ldots$ n.}
  \threecolrule{Le,Lf,Lg}{Le,LE,Lf}{Long Double $\ldots$ n.}
  \threecolrule{\omit}{g,G,Lg,LG}{e/E or f - shortest used}
\endthreecolumn\endindentedkeys

\function{long putl(long c, FILE \*fp);}
\expl{Output the long value {\sl c} into the stream {\sl fp}.}

\function{int puts(const~char \*buf);}
\expl{Write the string in {\sl buf} to \<stdout> appending a NL 
character.}

\function{short putw(short c, FILE \*fp);}
\expl{Output the short value {\sl c} into the stream {\sl fp}.}

\function{int remove(const~char \*fname);}
\expl{Remove file with name {\sl fname}.}

\function{int rename(const~char \*old, const~char \*new);}
\expl{Change name of file from {\sl old} to {\sl new}.}

\function{void rewind(FILE \*fp);}
\expl{Reset the filepointer from stream {\sl fp} to position 0.}

\function{int scanf(const~char \*fmt, $\ldots$);}
\function{int fscanf(FILE \*fp, const~char \*fmt, $\ldots$);}
\function{int sscanf(const~char \*buf, const~char \*fmt, $\ldots$);}
\expl{Formated input from either \<stdin>, {\sl fp} or {\sl buf}. (For
a description of the letters in the {\sl fmt} string see {\bf printf}.)}

\function{void setbuf(FILE \*fp, char \*buf);}
\expl{Set buffer of stream {\sl fp} to {\sl buf}.}

The following functions are defined as macros.

\function{int setvbuf(FILE \*fp, char \*buf, int mode, size\_t sz);}
\expl{Set buffer of stream {\sl fp} to {\sl buf} with size {\sl sz} and
mode {\sl mode}.}

\function{FILE \*tmpfile(void);}
\expl{Create a temporary file. File is deleted on normal termination.}

\function{char \*tmpnam(char \*buf);}
\expl{Create a string for a temporary filename.}

\function{void \_binmode(int bool);}
\expl{Set default open mode to binary (bool = true) or text.}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\section{I/O Control}

\#include \<ioctl.h>

\function{int ioctl(int fd, int cmd, void \*arg);}
\expl{Set or inquire i/o dependend parameter.}

\function{int stty(int fd, struct sgttyb \*\_tty);}
\function{int gtty(int fd, struct sgttyb \*\_tty);}
\expl{Set or inquire i/o parameters for descriptor {\sl fd}.}
\medskip
\#include \<fcntl.h>

\function{int fcntl(int fd, int cmd, void \*arg);}
\expl{Set or inquire file i/o dependend parameter (MiNT).}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\section{Memory Management}

\#include \<stdlib.h>

\function{void \*calloc(size\_t no, size\_t sz);}
\expl{Allocate and initialize memory for {\sl no} items of size {\sl size}.}

\function{void \*malloc(size\_t sz);}
\expl{Allocate {\sl sz} bytes of memory.}

\function{void \*realloc(void \*ptr, size\_t sz);}
\expl{Resize memory pointed to by {\sl ptr} to size {\sl sz}.}

\function{void free(void \*ptr);}
\expl{Free memory obtained by {\bf calloc}, {\bf malloc} or {\bf realloc}.}

\function{void \*alloca(size\_t sz);}
\expl{Allocate {\sl sz} bytes from the current function stack.}

\function{void \_malloczero(int bool);}
\expl{Zero allocated memory blocks. Default $==$ false.}

\function{void \_mallocChunkSize(size\_t Siz);}
\expl{Get memory from OS in atleast {\sl Siz} sized blocks. Default
$==$ 4K}
\medskip
\#include \<memory.h>

\function{void \*clalloc(long no, long sz);}
\function{void \*mlalloc(long sz);}
\function{void \*relalloc(void \*ptr, long sz);}
\expl{Apart from the above functions, these three functions are
additionally declared in memory.h and take {\sl long} arguments.}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\section{Character Classification and Conversion}

The following functions return $\ne$ 0, if character {\sl c} belongs
to the specified character set; 0 otherwise.

\#include \<ctype.h>

\paralign{{\bf #}({\sl c})\hfil\quad&#\hfil\cr
  \omit\rm function\hfil\quad&set\cr\noalign{\vskip 3pt}
  \twocol{isalnum}{Letter or Digit}
  \twocol{isalpha}{Letter}
  \twocol{isascii}{ASCII character (Codes: 0$\ldots$0177)}
  \twocol{iscntrl}{Control character (Codes: 0$\ldots$037, 0177)}
  \twocol{isdigit}{Digit}
  \twocol{isgraph}{Printable character except space}
  \twocol{islower}{Lowercase letter}
  \twocol{isprint}{Printable character}
  \twocol{ispunct}{Punctuation char. (not letter, digit or control)}
  \twocol{isspace}{Space, Tab, CR, NL, VT, FF or BS}
  \twocol{isupper}{Uppercase letter}
  \twocol{isxdigit}{Hexadecimal digit}
  \twocol{iswhite}{same as ispace()}
  \twocol{isodigit}{Octal digit}
  \twocol{iscymf}{Character starting a C identifier}
  \twocol{iscym}{Characters continuing a C identifier}
}

Character conversion functions

\paralign{{\bf #}({\sl c})\hfil\quad&#\hfil\cr
  \omit\rm function\hfil\quad&Meaning\cr\noalign{\vskip 3pt}
  \twocol{toupper}{Convert to uppercase letter}
  \twocol{\_toupper}{Convert to uppercase letter (macro)}
  \twocol{tolower}{Convert to lowercase letter}
  \twocol{\_tolower}{Convert to lowercase letter (macro)}
  \twocol{toint}{Convert digit to integer}
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\section{String Handling}

\#include \<string.h>

\function{int bcmp(const~void \*ptr1, const~void \*ptr2, size\_t no);}
\expl{Compare {\sl no} of bytes at position {\sl ptr1} with {\sl ptr2}.}

\function{void bcopy(const~void \*src, void \*dst, size\_t len);}
\expl{Copy {\sl len} bytes from position {\sl src} to {\sl dst}.}

\function{void bzero(void \*dst, size\_t len);}
\expl{Set {\sl len} bytes at position {\sl dst} to 0.}

\function{char \*index(const~char \*str, int charw);}
\expl{Same as {\bf strchr}.}

\function{void \*memccpy(void \*dst, const~void \*src, int ucharstop, size\_t no);}
\expl{Copy characters from {\sl src} to {\sl dst} until character {\sl
uchar\-stop}, but copy at most {\sl no} bytes.}

\function{void \*memchr(const~void \*ptr, int ucharwanted, size\_t no);}
\expl{Find character {\sl ucharwanted} in area at {\sl ptr}, but
compare at most {\sl no} character.}

\function{int memcmp(const~void \*ptr1, const~void \*ptr2, size\_t no);}
\expl{Compare {\sl no} bytes from memory area at {\sl ptr1} with area
at {\sl ptr2}.}

\function{void \*memcpy(void \*dst, const~void \*src, size\_t no);}
\expl{Copy {\sl no} of bytes from area at {\sl src} to {\sl dst}.}

\function{void \*memset(void \*ptr, int ucharfill, size\_t no);}
\expl{Set {\sl no} of bytes at position {\sl ptr} to character {\sl
ucharfill}.}

\function{char \*rindex(const~char \*str, int charw);}
\expl{Same as {\bf strrchr}.}

\function{char \*strcat(char \*dst, const~char \*src);}
\expl{Concatenate the string at {\sl src} to the string at {\sl dst}.}

\function{char \*strchr(const~char \*str, int charw);}
\expl{Find first occurence of character {\sl charw} in string {\sl str}.}

\function{int strcmp(const~char \*str1, const~char \*str2);}
\expl{Compare string {\sl str1} with string {\sl str1}.}

\function{char \*strcpy(char \*dst, const~char \*src);}
\expl{Copy string at {\sl src} to {\sl dst}.}

\function{size\_t strcspn(const~char \*str, const~char \*rej);}
\expl{Find length of initial segment of {\sl str} consisting entirely
of characters not from {\sl rej}.}

\function{char \*strdup(const~char \*str);}
\expl{Return a duplicate of string {\sl str}.}

\function{char \*strerror(int errno);}
\expl{Map error number {\sl errno} to descriptive string.}

\function{size\_t strlen(const~char \*str);}
\expl{Return length of string {\sl str}.}

\function{char \*strlwr(char \*str);}
\expl{Change all character from string {\sl str} to lowercase.}

\function{char \*strncat(char \*dst, const~char \*src, size\_t no);}
\expl{Concatenate the string at {\sl src} to the string at {\sl dst}, but copy
at most {\sl no} character.}

\function{int strncmp(const~char \*str1, const~char \*str2, size\_t no);}
\expl{Compare string {\sl str1} with string {\sl str1}, but compare at most
{\sl no} character.}

\function{char \*strncpy(char \*dst, const~char \*src, size\_t no);}
\expl{Copy string at {\sl src} to {\sl dst}, but at most {sl no} character.}

\function{char \*strpbrk(const~char \*str, const~char \*breakat);}
\expl{First occurrence of a character from string {\sl breakat} in string
{\sl str}.}

\function{char \*strrchr(const~char \*str, int charw);}
\expl{Find last occurence of character {\sl charw} in string {\sl str}.}

\function{char \*strrev(char \*str);}
\expl{Reverse all charcters in string {\sl str}. First character
becomes last character.}

\function{size\_t strspn(const~char \*str, const~char \*accept);}
\expl{Find length of initial segment of {\sl str} consisting entirely
of characters from {\sl accept}.}

\function{char \*strstr(const~char \*str, const~char \*wanted);}
\expl{Find first occurence of string {\sl wanted} in string {\sl
str}.} 

\function{char \*strtok(char \*str, const~char \*delim);}
\expl{Retrieve fields from string {\sl str}, that are delimited by
characters from string {\sl delim}.}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\section{Process Management}

\#include \<stdlib.h>

\function{void abort();}
\expl{Immediatly abort the running program.}

\function{int atexit(void (\*func)());}
\expl{Register a function for execution on termination.}

\function{void exit(int ret);}
\expl{Exit current process with return value {\sl ret}.}

\function{int system(const~char \*prog);}
\expl{Execute command {\sl prog} passed as a string.}
\medskip
\#include \<process.h>

\function{int spawnl(int mode, char \*path, $\ldots$);}
\function{int spawnv(int mode, char \*path, char {\*\*}argv);}
\function{int spawnle(int mode, char \*path, $\ldots$);}
\function{int spawnve(int mode, char \*path, char {\*\*}argv, char {\*\*}envp);}
\expl{Spawn a new process. (Only {\tt P\_WAIT} is allowed for {\sl
mode}).}

\function{int spawnvp(int mode, char \*name, char {\*\*}argv);}
\function{int spawnlp(int mode, char \*name, $\ldots$);}
\expl{Execute a program on the defautl system execution path. (The
current directory is always searched first.)}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\section{Date and Time}

\#include \<time.h>

\function{char \*asctime(const~struct tm \*t);}
\expl{Convert ``time'' structure to a string.}

\function{clock\_t clock();}
\expl{Return process time used so far in units of CLK\_TCK ticks per
second (under TOS, 200 per second).}

\function{char \*ctime(const~ime\_t \*t);}
\expl{Convert time in seconds since 1970 to a string.}

\function{double difftime(time\_t t1, time\_t t2);}
\expl{Return difference between two ``time\_t'' types.}

\function{struct~tm \*gmtime(const~ime\_t \*t);}
\expl{Get the Greenwich Mean time.}

\function{struct~tm \*localtime(const~ime\_t \*t);}
\expl{Convert given time in seconds since 1970 to local time.}

\function{time\_t mktime(const~struct tm \*t);}
\expl{Take a time structure and convert it into representation ``seconds
since midnight January 1 1970, GMT''.}

\function{size\_t strftime(char \*s, size\_t maxsize, const~char \*format,
const~struct tm \*timeptr);}
\expl{Print formatted information about a given time.}

\function{time\_t time(time\_t \*t);}
\expl{Return time in seconds since midnight January 1 1970, GMT.}

\function{void tzset();}
\expl{Set the timezone and dst flag to the local rules (depending on
environment variable ``TZ'').}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\section{File and Directory Information}

\#include \<types.h>\par
\#include \<stat.h>

\function{int  fstat(int fd, struct stat \*info);}
\expl{Obtain information about file assosiated with filedescriptor {\sl fd}.}

\function{int  lstat(const~char \*fname, struct stat \*info);}
\expl{Like {\sl stat} but return info about {\sl symbolic links}.}

\function{int  stat(const~char \*fname, struct stat \*info);}
\expl{Obtain information about file {\sl fname}.}
\medskip
\#include \<dirent.h>

\function{int closedir(DIR \*dirp);}
\expl{Close directory assosiated with {\sl dirp}.}

\function{DIR \*opendir(const~char \*dirname);}
\expl{Open directory {\sl dirname} for reading.}

\function{struct~dirent \*readdir(DIR \*dirp);}
\expl{Read an entry from directory assosiated with {\sl dirp}.}

\function{void rewinddir(DIR \*dirp);}
\expl{Seek to the beginning of directory assosiated with {\sl dirp}.}

\function{void seekdir(DIR \*dirp, off\_t loc);}
\expl{Seek to position {\sl loc} in the directory assosiated with {\sl
dirp}.}

\function{off\_t telldir(DIR \*dirp);}
\expl{Get the current position in directory assosiated with {\sl
dirp}.} 
\medskip
\#include \<ftw.h>

\function{int ftw(char \*path, int (\*fn)(), int param);}
\expl{Recursively walk tree rooted at {\sl path} applying function {\sl fn}.}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\section{Regular Expressions}

\#include \<regexp.h>

\function{regexp \*regcomp(char \*exp);}
\expl{Compile a regular expression into an internal code.}

\function{int regexec(regexp \*prog, char \*string, int bolflag);}
\expl{Match the previously compiled expression {\sl prog} against the
{\sl string}.}

\function{void regsub(regexp \*prog, char \*source, char \*dest);}
\expl{Substitute the previously matched expression {\sl prog} with
{\sl source}. The result is copied to {\sl dest}.}

\function{void regdump(regexp \*r);}
\expl{Dump the regular expression {\sl r} onto \<stdout> in vaguely
comprehensible form.}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\section{Setjmp \& Signal Stuff}

\#include \<setjmp.h>

\function{int setjmp(jmp\_buf buf);}
\expl{Prepare buffer {\sl buf} for non local goto via {\bf longjmp}().}

\function{void longjmp(jmp\_buf buf, int rv);}
\expl{Return to previously saved context {\sl buf} with return value
{\sl rv}.}

\function{int catch(jmp\_buf id, int (*fn)(void));}
\expl{}

\function{void throw(jmp\_buf id, int rv);}
\expl{}
\medskip

\#include \<signal.h>

\function{{\_\_Sigfunc} signal(int sig, \_\_Sigfunc func);}
\expl{Install the handler {\sl func} for signal {\sl sig}.}

\function{int raise(int sig);}
\expl{}

\function{long sigsetmask(long mask);}
\expl{(MiNT)}

\function{long sigblock(long mask);}
\expl{(MiNT)}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\section{U*IX Compatibility Routines}

\#include \<unistd.h>

\function{void \_exit(int ret);}
\expl{Exit the current process without cleaning up. (This is a {\bf
Pterm()})}

\function{int access(const~char \*fname, int mode);}
\expl{Check, if file {\sl fname} is accessable with mode {\sl mode}.}

\function{int chdir(const~char \*dname);}
\expl{Chane the current working directory to {\sl dname} including drive
specification.}

\function{int chmod(const~char \*fname, int mode);}
\expl{Change permissions of file {\sl fname} to {\sl mode}.}

\function{int chown(const~char \*fname, int uid, int gid);}
\expl{Change owner and group of file {\sl fname}. (Fake for now)}

\function{int close(int fd);}
\expl{Close the file assosiated with file descriptor {\sl fd}.}

\function{int creat(const~char \*fname, unsigned mode);}
\expl{Create the file {\sl fname} with mode {\sl mode}.}

\function{int dup(int fd);}
\expl{Duplicate filedescriptor {\sl fd}.}

\function{int dup2(int fd1, int fd2);}
\expl{Duplicate filedescriptor {\sl fd1} to {\sl fd2}.}

\function{int execve(char \*path, char {\*\*}argv, char {\*\*}envp);}
\function{int execv(char \*path, char {\*\*}argv);}
\expl{Execute a new process from {\sl path} after a {\sl fork()}.}

\function{int fork();}
\function{int vfork();}
\expl{Simulate a non mul\-ti\-task\-ing fork. {\sl vfork} shares
data + stack with parent.}

\function{char \*getcwd(char \*buf, int size);}
\function{char \*getwd(char \*buf);}
\expl{Get the current working directory.}

\function{int getgid();}
\function{int getuid();}
\expl{Get user and group id's. (Fake for now, returning alsways
root).} 

\function{int getegid();}
\function{int geteuid();}
\expl{Get effective user and group id's.}

\function{char \*getlogin();}
\expl{Return the user's login name. (Password file and environment are
seached in order).}

\function{int getopt(int argc, const~char {\*\*}argv, const~char \*opt);}
\expl{Extract the command line options described by {\sl opt} from
{\sl argv}.}

\function{int getpgrp();}
\function{int setpgrp();}
\expl{Get or create a process group (This basically a fake; both
return {\bf getpid()}).}

\function{int getpid();}
\expl{Return a process id for the currently running process (from the
basepage).} 

\function{int getppid();}
\expl{Get parent process id.}

\function{char \*initstate(unsigned seed, char \*arg\_state, int n);}
\expl {Initialize state array of generator for {\sl random}.}

\function{int isatty(int fd);}
\expl{Check, if {\sl fd} is associated with a terminal (screen).}

\function{int kill(int, int);}

\function{int link(const~char \*old , const~char \*new);}
\expl{Make a new link from {\sl new} to {\sl old}. Always fails.}

\function{int symlink(char \*old , char \*new);}
\expl{Make a new symbolic link from {\sl new} to {\sl old}.
Env. UNIXMODE determines behavior.}

\function{int readlink(char \*fname , char \*buf, int siz);}
\expl{Read the link for {\sl fname} into {\sl buf}.}

\function{long lseek(int fd, long pos, int whence);}
\expl{Set the current file posistion to position {\sl pos} relative to
{\sl whence}.}

\function{int mkdir(const~char \*dname);}
\expl{Make a directory with name {\sl dname}.}

\function{char \*mktemp(char \*pattern);}
\expl{Return a filename for a temporary file, build after {\sl
pattern}.}

\function{int open(const~char \*fname, int mode, $\ldots$);}
\expl{Open the file {\sl fname} with mode {\sl mode}.}

\function{void psignal(int signal, const~char \*prefix);}
\expl{Print a error message describing the signal with a user
comment.}

\function{long random();}
\expl{Return a pseudo random number in the range from 0 to $2^31$ - 1.}

\function{int rmdir(const~char \*dname);}
\expl{Remove the directory with name {\sl dname}.}

\function{int read(int fd, void \*buf, int cnt);}
\function{long lread(int fd, void \*buf, long cnt);}
\expl{Read {\sl cnt} bytes from file descriptor {\sl fd} into buffer
{\sl buf}.}

\function{void \*sbrk(size\_t size);}
\function{void \*lsbrk(long size);}
\expl{Emulation of the U\*ix {\bf sbrk()} system call.}

\function{void setlinebuf(FILE \*fp);}
\expl{Change the buffering on stream {\sl fp} from block/unbuffered to
line buffered.}

\function{int setegid(int gid);}
\function{int seteuid(int uid);}
\expl{Set the effective groud and user id.}

\function{char \*setstate(char \*arg\_state);}
\expl{Switch state of generator for {\sl random}.}

\function{int sleep(int n);}
\expl{Sleep for {\sl n} number of seconds.}

\function{int srandom(unsigned int x);}
\expl{Seed generator for {\sl random}.}

\function{int stime(long \*time);}
\expl{Set the current time to {\sl time} in U\*ix format.}

\function{long tell(int fd);}
\expl{Get the current file position of the file associated with {\sl
fd}.}

\function{int times(struct tms \*buf);}
\expl{Get process times into {\sl buf}.}

\function{int umask(int mode);}
\expl{Set access mask. (Fake for now)}

\function{int unlink(const~char \*fname);}
\expl{Remove the file with name {\sl fname}.}

\function{int usleep(long n);}
\expl{Sleep for {\sl n} number of milliseconds.}

\function{int utime(const~char \*fname, const~struct utimbuf \*ftime);}
\expl{Set the modification time and date of file {\sl fname} to {\sl
ftime}.}

\function{int write(int fd, const~void \*buf, int cnt);}
\function{long lwrite(int fd, const~void \*buf, long cnt);}
\expl{Write {\sl cnt} bytes from buffer {\sl buf} to file descriptor
{\sl fd}.}

\function{int wait(int \*exit\_code);}
\expl{Wait for child process.}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\section{Password and Group Handling}

\#include \<unixlib.h>

\function{int endpwent();}
\expl{Close password file.}

\function{int setpwent();}
\expl{Open password file for further operations.}

\function{void setpwfile(char \*fname);}
\expl{Use the {\sl fname} instead of {\tt /etc/passwd} as password
file.}
\medskip
The following routines already use the above functions.

\#include \<pwd.h>

\function{struct~passwd \*getpwent();}
\expl{Return an entry from the password file.}

\function{struct~passwd \*getpwuid(int uid);}
\expl{Return the entry from the password file for {\sl uid}.}

\function{struct~passwd \*getpwnam(char \*user);}
\expl{Return the entry from the password file for {\sl user}.}
\medskip
\#include \<grp.h>

\function{struct~group \*getgrgid(int gid);}
\expl{Return the entry from the group file for {\sl gid}. (Mostly fake,
returning root or user as groupnames)}

\function{struct~group \*getgrnam(char \*gname);}
\expl{Return the entry from the group file for {\sl gname}. (Mostly
fake, returning root or user as groupnames)}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\section{Value Conversion}

\#include \<stdlib.h>

\function{double atof(const~char \*str);}
\expl{Return double value of number presented in {\sl str}.}

\function{int atoi(const~char \*str);}
\expl{Return int value of number presented in {\sl str}.}

\function{long atol(const~char \*str);}
\expl{Return long value of number presented in {\sl str}.}

\function{int abs(int val);}
\function{long labs(long val);}
\expl{Return absolute value of {\sl val}.}

\function{long strtol(const~char \*nptr, char {\*\*}endptr, int base);}
\function{unsigned~long strtoul(const~char \*nptr, char {\*\*}endptr, int base);}
\expl{Return the value of the number in {\sl nptr} with {\sl base}
putting the endaddress of the numerical string into {\sl endptr}.}

\function{double strtod(const~char \*nptr, const~char {\*\*}endptr);}
\expl{Return the double value of the number in {\sl nptr} putting the
endaddress of the numerical string into {\sl endptr}.}
\medskip
\#include \<support.h>

\function{char \*\_itoa(int val, char \*buf, int radix);}
\function{char \*\_ltoa(long val, char \*buf, int radix);}
\function{char \*\_ultoa(unsigned long val, char \*buf, int radix);}
\expl{Convert the value {\sl val} to a string in {\sl buf}
according to {\sl radix}.} 
\medskip
\#include \<locale.h>

\function{struct~lconv \*localeconv();}
\expl{Get rules of the current locale}

\function{char \*setlocale(int category , const~char \*name);}
\expl{Define locale named in {\sl name}.}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\section{Miscellaneous}

\#include \<stdlib.h>

\function{void \*bsearch(const~void \*key, const~void \*base,
size\_t num, size\_t size, int (\*cmp)());} 
\expl{Binary search a field starting at {\sl base} with {\sl num}
elements each size {\sl size} for {\sl key}.}

\function{div\_t div(int num, int denom);}
\function{ldiv\_t ldiv(long num, long denom);}
\expl{Perform division and return both quotient and remainder.}

\function{char \*getenv(const~char \*name);}
\expl{Get the contents of the environment variable {\sl name}.}

\function{void qsort(void \*base, size\_t num, size\_t size, int (\*cmp)());} 
\expl{Quick sort an array of {\sl num} elements with size {\sl size}
starting at {\sl base}.}

\function{int rand();}
\expl{Return a pseudo random number in the range from 0 to {\tt RAND\_MAX}.}

\function{void srand(unsigned int seed);}
\expl{Use {\sl seed} to initialize the pseudo-random number generator.}
\medskip
\#include \<support.h>

\function{int console\_input\_status(int handle);}
\expl{Check, if character is available from standart CON:. (This is
the same as {\bf Cconis})}

\function{unsigned~int console\_read\_byte(int handle);}
\expl{Raw input from standart CON: without echoing to screen. (This is
the same as {\bf Crawcin})}

\function{void console\_write\_byte(int handle, int character);}
\expl{Write character {\sl c} to handle {\sl handle}. (This is a {\bf
Fwrite} with count 1)}

\function{void dos2unx(const~char \*t\_fname, char \*u\_fname);}
\expl{Convert filenames from TOS format to U\*ix format.}

\function{time\_t dostime(time\_t);}
\expl{Convert U\*ix time to TOS time and date (lower word = time, upper
word = date).}

\function{char \*findfile(char \*fname, char \*path, char {\*\*}ext);}
\expl{Locate the file {\sl fname} along the paths in {\sl path} with
{\sl ext} containing possible extensions.}

\function{void fnmapfunc(fnmapfunc\_t u2dos, fnmapfunc\_t dos2u);}
\expl{Set mapping functions for the {\bf unx2dos} and {\bf dos2unx}
routines.}

\function{time\_t unixtime(unsigned tostime, unsigned tosdate);}
\expl{Convert a TOS time/date pair into a U\*ix time.}

\function{void unx2dos(const~char \*u\_fname, char \*t\_fname);}
\expl{Convert filenames from U\*ix format to TOS format.}

\function{void \_set\_unixmode(char \*mode);}
\expl{Set features of the extended file system.}

\function{void \_uniquefy(char \*dos);}
\expl{Make an unigue TOS filename for the extended file system.}
\medskip
\#include \<sysvars.h>

\function{long get\_sysvar(void \*var);}
\expl{Get the contents of the system variable {\sl var}.}

\function{void set\_sysvar\_to\_long(void \*var, long val);}
\expl{Set the system variable {\sl var} to the long value {\sl val}.}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\section{Profiling}

\#include \<support.h>

also see {\sl gprof.ttp} and {\sl -pg} option to {\sl gcc}

\function{void monstartup(void \*lpc, void \*hpc);}
\expl{High level interface to {\sl profil}. {\sl [lpc,hpc]} is the
range to sample. Necessary memory is dynamically allocated.}

\function{void monitor(void \*lpc, void \*hpc, void \*buf,
size\_t bsiz, unsigned int nfunc);}
\expl{Low level interface to profil. {\sl buf} is a user supplied
buffer. PC samples over {\sl[lpc,hpc]} and {\sl mcount()} call records
are accumulated in {\sl buf}.}

\function{void moncontrol(long flag);}
\expl{Selectively control profiling in a program.}

\function{int profil(void \*buf, size\_t bsiz, size\_t off, int shift);}
\expl{Execution time profil. Pc is examined every 20ms, (PC-off)$\gg$ shift
if in range, will increment short in {\sl buf}.}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\section{Mathematical Functions}

\#include \<math.h>

\function{double acos(double);}
\function{double acosh(double);}
\function{double asin(double);}
\function{double asinh(double);}
\function{double atan(double);}
\function{double atan2(double, double);}
\function{double atanh(double);}
\function{double ceil(double);}
\function{double copysign(double, double);}
\function{double cos(double);}
\function{double cosh(double);}
\function{double dabs(double);}
\function{double exp(double);}
\function{double fabs(double);}
\function{double floor(double);}
\function{double fmod(double, double);}
\function{double frexp(double, int \*);}
\function{double ldexp(double, int);}
\function{double log(double);}
\function{double log10(double);}
\function{double modf(double, double \*);}
\function{double poly(int, double \*, double);}
\function{double pow(double, double);}
\function{double rint(double);}
\function{double sin(double);}
\function{double sinh(double);}
\function{double sqrt(double);}
\function{double tan(double);}
\function{double tanh(double);}

\function{int matherr(struct exception \*);}
\function{int pmlcfs(int, int);}
\function{int pmlcnt(void);}
\function{int pmlerr(int);}
\function{int pmllim(int);}
\function{int pmlsfs(int, int);}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\section{GEMDOS Calls via Trap 1}

\#include \<osbind.h>

The following assignment is valid by default:

\beginthreecolumn
  \threecolrule{Device}{handle}{}
  \noalign{\hrule}
  \threecolrule{CON:}{\omit\hfil 0\hfil}{Keyboard}
  \threecolrule{CON:}{\omit\hfil 1\hfil}{Screen}
  \threecolrule{AUX:}{\omit\hfil 2\hfil}{Serial port}
  \threecolrule{PRN:}{\omit\hfil 3\hfil}{Parallel port}
\endthreecolumn

\function{long Cauxin();}
\expl{Read character from standart AUX:.}

\function{short Cauxis();}
\expl{Check, if character is available from standart AUX:.}

\function{short Cauxos();}
\expl{Check, if character can be written to standart AUX:.}

\function{void Cauxout(short c);}
\expl{Write character {\sl c} to standart AUX:.}

\function{long Cconin();}
\expl{Read a character from standart CON:.}

\function{short Cconis();}
\expl{Check, if character is available from standart CON:.}

\function{short Cconos();}
\expl{Check, if character can be written to standart CON:.}

\function{void Cconout(short c);}
\expl{Write character {\sl c} to standart CON:.}

\function{void Cconrs(char \*buf);}
\expl{Read edited data from standart CON:. {\sl buf[0]} contains number
of characters minus 1 to read.}

\function{void Cconws(const~char \*str);}
\expl{Write string {\sl str} to standart CON:.}

\function{long Cnecin();}
\expl{Raw input from standart CON: without echoing to screen, but
with interpretation of CTRL-S, CRTL-Q and CRTL-C.}

\function{short Cprnos();}
\expl{Check, if character can be written to standart PRN:.}

\function{void Cprnout(short c);}
\expl{Write character {\sl c} to standart PRN:.}

\function{long Crawcin();}
\expl{Raw input from standart CON: without echoing to screen.}

\function{long Crawio(short data);}
\expl{Raw I/O to standart CON:. If {\sl data} = 0xff read from CON:,
otherwise output to CON:.}

\function{short Dcreate(const~char \*dname);}
\expl{Create a directory with name {\sl dname}.}

\function{long Ddelete(const~char \*dname);}
\expl{Remove a directory with name {\sl dname}.}

\function{long Dfree(DISKINFO \*buf, short drv);}
\expl{Get available space of drive {\sl drv} into {\sl buf}.
{\sl drv} = 0 means current drive.}

\function{short Dgetdrv();}
\expl{Get the number of the default drive.}

\function{long Dgetpath(void \*buf, short drv);}
\expl{Get the current directory of drive {\sl drv}.
{\sl drv} = 0 means current drive.}

\function{long Dsetdrv(short d);}
\expl{Set the number of the default drive.}

\function{long Dsetpath(const~char \*path);}
\expl{Set path for current drive to {\sl path}.}

\function{short Fattrib(const~char \*fname, short rwflag, short attr);}
\expl{Get ({\sl rwflag} = 0) or set ({\sl rwflag} = 1)
attribute byte of file {\sl fname}.}

\function{long Fclose(short handle);}
\expl{Close the file assosiated with {\sl handle}.}

\function{struct~\_dta \*Fgetdta();}
\expl{Get the current disk transfer address.}

\function{long Fcreate(const~char \*fname, short mode);}
\expl{Create file {\sl fname} with mode {\sl mode}.}

\function{long Fdatime(DOSTIME \*timeptr, short hdl, short rwflg);}
\expl{Get ({\sl rwflag} = 0) or set ({\sl rwflg} = 1) the time
structure of the file associated by handle {\sl hdl}.}

\function{long Fdelete(const~char \*fname);}
\expl{Delete file with name {\sl fname}.}

\function{long Fdup(short handle);}
\expl{Return a second handle for a standart handle (0$\ldots$5).}

\function{long Fforce(short Hstd, short Hnew);}
\expl{Replace one of the standart handles (0$\ldots$5) with {\sl Hnew}.}

\function{long Fopen(const~char \*fname, short mode);}
\expl{Open file {\sl fname} with mode {\sl mode}.}

\function{long Fread(short handle, long cnt, void \*buf);}
\expl{Read {\sl cnt} bytes into {\sl buf} from file assosiated
with {\sl handle}.}

\function{short Frename(const~char \*old, const~char \*new);}
\expl{Change name of file from {\sl old} to {\sl new}. Also directories}

\function{long Fseek(long pos, short handle, short whence);}
\expl{Set access pointer to position {\sl pos} relative to
{\sl whence}.}

\function{void Fsetdta(struct \_dta \*ptr);}
\expl{Set the current disk tranfer address to {\sl ptr}.}

\function{long Fsfirst(const~char \*filespec, short attr);}
\expl{Get first directory slot, which matches {\sl filespec} and {\sl
attr}.}

\function{long Fsnext();}
\expl{Get next match of search started by {\bf Fsfirst}.}

\function{long Fwrite(short handle, long cnt, const~void \*buf);}
\expl{Write {\sl cnt} bytes from {\sl buf} to file assosiated with
{\sl handle}.}

\function{long Malloc(long size);}
\expl{Allocate {\sl size} bytes of memory.}

\function{long Mfree(void \*ptr);}
\expl{Release block of memory.}

\function{long Mshrink(long ptr, long size);}
\expl{Shrink size of memory block obtained by {\bf Malloc}.}

\function{long Pexec(short mode, const~char \*prog, const~char
\*tail, char {\*\*}env);} 
\expl{Execute {\sl prog} with mode {\sl mode}. The following bits in
the {\bf a\_ldflags} of the programm header modify behaviour:}

\beginindentedkeys\begintwocolumn
  \twocolrule{Bit}{Meaning}
  \noalign{\hrule}
  \twocolrule{0}{Fastload bit (clear only BSS)}
  \twocolrule{1}{load into fast ram (TT)}
  \twocolrule{2}{satisfy {\bf Malloc}()s from fast ram (TT)}
  \twocolrule{3$\ldots$27}{reserved}
  \twocolrule{28$\ldots$31}{TPA size field (TT)}
\endtwocolumn\endindentedkeys

\function{void Pterm(short rv);}
\expl{Terminate current process with return value {\sl rv}.}

\function{void Pterm0();}
\expl{Terminate current and return to calling process.}

\function{void Ptermres(long save, short ret);}
\expl{Terminate and stay resident, but keep {\sl save} bytes of memory.}

\function{long Super(void \*stack);}
\expl{Inquire ({\sl stack} = 1), set ({\sl stack} = 0) or return from
({\sl stack} $>$ 0) supervisor mode.}

\function{short Sversion();}
\expl{Get the version number of GEMDOS.}

\function{short Tgetdate();}
\expl{Get the GEMDOS internal date. The harware clock is read in 
MEGA ST's.}

{\leftskip=\myindent The return value is composed of the following
fields:\par}

\beginindentedkeys\begintwocolumn
  \twocolrule{Bits}{Meaning (Range)}
  \noalign{\hrule}
  \twocolrule{0$\ldots$4}{Day (0$\ldots$31)}
  \twocolrule{5$\ldots$8}{Month (1$\ldots$12)}
  \twocolrule{9$\ldots$15}{Year (0$\ldots$119)(+1980)}
\endtwocolumn\endindentedkeys
 
\function{short Tgettime();}
\expl{Get the GEMDOS internal time.}

{\leftskip=\myindent The return value is composed of the following
fields:\par} 

\beginindentedkeys\begintwocolumn
  \twocolrule{Bits}{Meaning (Range)}
  \noalign{\hrule}
  \twocolrule{0$\ldots$4}{Seconds (0$\ldots$29) have to be doubled}
  \twocolrule{5$\ldots$10}{Minutes (0$\ldots$59)}
  \twocolrule{11$\ldots$15}{Hours (0$\ldots$23)}
\endtwocolumn\endindentedkeys

\function{long Tsetdate(short date);}
\expl{Set the GEMDOS internal date.}

\function{long Tsettime(short time);}
\expl{Set the GEMDOS internal time.}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\section{GEMDOS Calls unique to the TT}

\#include \<osbind.h>

\function{long Maddalt(long start, long size);}
\expl{Extend the memory, which is managed by {\bf Mxalloc}() and {\bf
Pexec}() with {\sl size} bytes starting at address {\sl start}.}

\function{void \*Mxalloc(long amount, short flag);}
\expl{Allocate {\sl amount} bytes of memory from the OS pool. $-1$ for
{\sl amount} returns the max.~size for an allocatable segment. {\sl
flag} defines were the memory is allocated.}

\beginindentedkeys\begintwocolumn
  \twocolrule{Value}{Meaning}
  \noalign{\hrule}
  \twocolrule{0}{alloc mem {\bf only} in ST ram}
  \twocolrule{1}{alloc mem {\bf only} in TT ram}
  \twocolrule{2}{alloc mem in ST ram, if possible}
  \twocolrule{3}{alloc mem in TT ram, if possible}
\endtwocolumn\endindentedkeys


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\section{GEMDOS Calls unique to MiNT}

\#include \<mintbind.h>

\function{long Dpathconf(char *name, short which);}
\expl{Return information about various limits/capabilities of the file
system on which file {\sl name} is located. The information returned
depends upon {\sl which} as follows:}

\beginindentedkeys\begintwocolumn
  \twocolrule{Value}{Meaning}
  \noalign{\hrule}
  \twocolrule{$-$1}{max. legal value for {\sl which}}
  \twocolrule{0}{int. limit of open files}
  \twocolrule{1}{max. \# of links to a file}
  \twocolrule{2}{max. len. of a full pathname}
  \twocolrule{3}{max. len. of an individuell file name}
  \twocolrule{4}{\# of bytes written atomic. to a FIFO}
\endtwocolumn\endindentedkeys

\function{short Fcntl(short f, void \*arg, short cmd);}
\expl{Do file control commands on file handle {\sl f} of an open file.
{\sl cmd} and {\sl arg} vary upon the file type of {\sl f} and the
operation.} 

\function{long Fgetchar(short f, short mode);}
\expl{Read a character from the file assosiated with handle {\sl f}.
{\sl mode} determines mode (cooked, raw, echo).}

\function{long Finstat( short f);}
\expl{Return the number of characters available for reading from file
handle {\sl f}. (Usefull only for terminals and pipes)} 

\function{long Foutstat(short f);}
\expl{Return the number of bytes, that may be written to file handle
{\sl f} before the writing process have to go to sleep.}

\function{short Fpipe(short \*ptr);}
\expl{Create a pipe. {\sl ptr[0]} is the read-only end and {\sl
ptr[1]} the write-only end file handle of the pipe.}

\function{long Fputchar(short f, long ch, short mode);}
\expl{Write a character to the file whose handle is {\sl f}. {\sl
mode} is as for {\bf Fgetchar}.}

\function{short Fselect(unsigned~short timeout, long \*rfds, long
\*wfds, long \*xfds);}
\expl{See, which files are ready for reading, writing or have error
conditions on them. {\sl timeout} is the number of milliseconds to
wait before returning. A bit in one of the {\sl [rwf]fds} bitmaps,
which is on, indicates the file descriptor to be tested.}

\function{void Pause();}
\expl{Suspend the process until it receives a signal that is not being
ignored and is not masked.}

\function{short Pdomain(short newdom);}
\expl{If {\sl newdom} is not $-1$, sets the process domain of the
current process to {\sl newdom}. Alway returns previous domain. Domain
0 is the TOS domain and the default; domain 1 is the MiNT domain.}

\function{long Pfork();}
\expl{Create a new process, that is the duplicate of the current one,
but has its own copy of the address space. The return value is 0 for
the child, and the child's pid in the parent.}

\function{short Pgetgid();}
\function{short Psetgid(short id);}
\expl{Get or set the group id of the current process.}

\function{short Pgetpid();}
\function{short Pgetppid();}
\function{short Pgetpgrp();}
\expl{Get the currents process' process id, it's parent's process id,
or its process group.}

\function{short Pgetuid();}
\function{short Psetuid(short id);}
\expl{Return or set the user id under which the current process is
running.}

\function{short Pkill(short pid, short sig);}
\expl{Send signal {\sl sig} to process with given {\sl pid}. If {\sl
pid}$ == 0$, the signal is sent to all proc's with the same process group.}

\function{void Prusage(long rsp[8]);}
\expl{Get various resource information from the operating system.}

\beginindentedkeys\begintwocolumn
  \twocolrule{Value}{Meaning}
  \noalign{\hrule}
  \twocolrule{r[0]}{time spent in MiNT kernel}
  \twocolrule{r[1]}{time spent in proc's own code}
  \twocolrule{r[2]}{tot. kernel time for children}
  \twocolrule{r[3]}{tot. user code time for children}
  \twocolrule{r[4]}{memory alloc. for this proc.}
  \twocolrule{r[5]-r[7]}{reserved}
\endtwocolumn\endindentedkeys


\function{long Psetlimit(short lim, long val);}
\expl{Get/Set a resource limit for a process. The old limit is
returned. If {\sl val} is negativ, the limit is unchanged; 0 sets
umlimited resource; any other value sets that limit. {\sl lim} is
defined as follows:}

\beginindentedkeys\begintwocolumn
  \twocolrule{Value}{Meaning}
  \noalign{\hrule}
  \twocolrule{1}{max. CPU for proc in milliseconds}
  \twocolrule{2}{max. memory allowed for proc.}
  \twocolrule{3}{limit of {\bf Malloc}()'ed mem. for proc.}
\endtwocolumn\endindentedkeys

\function{short Psetpgrp(short pid, short newgrp);}
\expl{Set the process group of the process with given {\sl pid} to
{\sl newgrp}.}

\function{long Psigblock(unsigned~long mask);}
\expl{Adds the signal in the 32 bit {\sl mask} to the blocked set. The
return value is the set of previously blocked signals. (Usage: {\bf
Psigblock}(1 $<<$ SIG\#))}

\function{long Psignal(short signal, (void)(*handler)(long sig);}
\expl{Installs a signal handler for the indicated {\sl signal}. {\sl
handler} is the address of a function, that will be called, when the
signal occurs.}

\function{long Psigpending();}
\expl{Return a longword containing the signals, that have been sent to
the process, but not yet handled.}

\function{long Psigreturn();}
\expl{Prepare to exit from a signal handler. (only needed with {\bf
longjmp}())} 

\function{long Psigsetmask(unsigned~long mask);}
\expl{Replaces the set of blocked signals with {\sl mask}. The old set
of blocked signals is returned.}

\function{long Pusrval(long arg);}
\expl{Return the process specific user value for this process.}

\function{short Pvfork();}
\expl{Creates a copy of the current process. Both child and parent
share the same address space. The return value is 0 for the child, and
the child's pid in the parent.}

\function{long Pwait();}
\expl{Return the exit status of the children run asyncronously.}

\function{long Pwait3(short flag, long *rusage);}
\expl{Wait for a child and return its exit status. If {\sl rusage} is
non zero, {\sl rusage}[0] contains millisec's spend by child in user
space and {\sl rusage}[1] contains millisec's spent by child in kernel
space.}

\function{short Snice(short delta);}
\expl{Set current processes ``niceness''. A nice process has a lower
priority.}

\function{short Syield();}
\expl{Tell MiNT, that is okay to switch processes right now. Always
returns 0.}

\function{long Sysconf(short n);}
\expl{Return information about various limits/capabilities of the
current version of MiNT. Possible values for {\sl n} are:}

\beginindentedkeys\begintwocolumn
  \twocolrule{Value}{Meaning}
  \noalign{\hrule}
  \twocolrule{$-$1}{max. legal value for {\sl n}}
  \twocolrule{0}{max. \# of mem. regions per proc.}
  \twocolrule{1}{max. len. of Pexec command line}
  \twocolrule{2}{max. \# of open files per proc.}
  \twocolrule{3}{\# of suppl. group id's}
  \twocolrule{4}{\# of procs per user}
\endtwocolumn\endindentedkeys

\function{long Talarm(long sec);}
\expl{Set an alarm to go off {\sl sec} from now. If {\sl sec$==$0}
cancel any pending alarm.}

\function{Dos\_tab();}
\function{Bios\_tab();}
\function{Xbios\_tab();}
\expl{These functions return a pointer to the GEMDOS, BIOS and XBIOS
funxtion tables.}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\section{BIOS Calls via Trap 13}

\#include \<osbind.h>

Available devices for BIOS calls are:

\beginthreecolumn
  \threecolrule{Device}{\#}{}
  \noalign{\hrule}
  \threecolrule{\_PRT}{0}{parallel port}
  \threecolrule{\_AUX}{1}{serial port}
  \threecolrule{\_CON}{2}{console}
  \threecolrule{\_MIDI}{3}{MIDI port}
  \threecolrule{\_IKBD}{4}{keyboard processor}
  \threecolrule{\_RAWCON}{5}{console (no terminal emulation)}
\endthreecolumn

\function{long Bconin(short dev);}
\expl{Read a character from device {\sl dev}. (Allowed devices:
0$\ldots$3}

\function{void Bconout(short dev, short c);}
\expl{Write character {\sl c} to device {\sl dev}. (Allowed 
devices: 0$\ldots$5)}

\function{short Bconstat(short dev);}
\expl{Get the status of the input device {\sl dev}. (Allowed 
devices: 1$\ldots$3).}

\function{short Bcostat(short dev);}
\expl{Get the status of the output device {\sl dev}. (Allowed
devices: 0$\ldots$4)}

\function{long Drvmap();}
\expl{Get the bitmap of available drives.}

\function{BPB \*Getbpb(short dev);}
\expl{Get the BIOS parameter block of device {\sl dev}.}

\function{void Getmpb(void \*ptr);}
\expl{The memory parameter block pointed to by {\sl ptr} is filled.}

\function{long Kbshift(short mode);}
\expl{Get ({\sl mode} = -1) or set the current keyboard status.}

{\leftskip=\myindent The return value is composed of the following
fields:\par} 

\beginindentedkeys\begintwocolumn
  \twocolrule{Bit}{Meaning}
  \noalign{\hrule}
  \twocolrule{0}{Right shift key}
  \twocolrule{1}{Left shift key}
  \twocolrule{2}{Control key}
  \twocolrule{3}{Alternate key}
  \twocolrule{4}{Caps lock key}
  \twocolrule{5}{r. mouse button (ClrHome)}
  \twocolrule{6}{l. mouse button (Insert)}
  \twocolrule{7}{Reserved (0)}
\endtwocolumn\endindentedkeys

\function{short Mediach(short dev);}
\expl{Check, if disk in device {\sl dev} has changed.}

\function{short Rwabs(short rwflag, long buf, short n, short
sector, short dev);}
\expl{Read ({\sl rwflag} = 0) or write ({\sl rwflag} = 1) {\sl n}
logical sectors from device {\sl dev}.}
 
\function{void~(\*)(void) Setexc(short vecnum, long vecptr);}
\expl{Get (vecptr = -1) or set an M68000 exception vector.}

\function{long Tickcal();}
\expl{Get the number of milliseconds between two calls of {\bf tickcal}.}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\section{XBIOS Calls via Trap 14}

\#include \<osbind.h>

\function{void Bioskeys();}
\expl{Reset to initial keyboard mapping tables.}

\function{short Blitmode(short flag);}
\expl{Configure the blitter chip.}

\function{short Cursconf(short rate, short attr);}
\expl{Configure the cursor and blinking speed.}

\function{void Dosound(void \*ptr);}
\expl{Output a number of bytes to the soundchip.}

\function{short Floprd(void \*buf, long filler, short drv, short
sect, short trk, short side, short n);}
\expl{Read physically {\sl n} sectors from floppy drive {\sl drv}.}

\function{short Flopwr(void \*buf, long filler, short drv, short
sect, short trk, short side, short n);}
\expl{Write physically {\sl n} sectors to floppy drive {\sl drv}.}

\function{short Flopfmt(void \*buf, long filler, short drv, short
spt, short trk, short side, short i, long m, short v);}
\expl{Format track {\sl trk} on drive {\sl drv} with {\sl spt} sectors
per track.}

\function{short Flopver(void \*buf, long filler, short drv, short
spt, short trk, short side, short n);}
\expl{Read a number of sectors and compare with memory.}

\function{short Getrez();}
\expl{Get the current display resolution (0 = low, 1 = mid, 2 = high).}

\function{long Gettime();}
\expl{Get the time from the hardware clock (lower word = time, upper
word = date).}

\function{short Giaccess(short data, short reg);}
\expl{Get or set a register of the GI sound chip.
Set bit 8 of {\sl reg} for write operation.}

\function{void Ikbdws(short cnt, void \*ptr);}
\expl{Write a sequence of {\sl cnt}+1 bytes to the keyboard processor.}

\function{void Initmous(short type, void \*param, void \*vptr);}
\expl{Initialize the mouse cursor routines.}

\function{IOREC \*Iorec(short ioDEV);}
\expl{Get a pointer to a device specific buffer.}

\function{void Jdisint(short vnum);}
\expl{Disable interrupt {\sl vnum} of the MFP 68901 chip.}

\function{void Jenabint(short vnum);}
\expl{Enable interrupt {\sl vnum} of the MFP 68901 chip.}

\function{KBDVECS \*Kbdvbase();}
\expl{Get a pointer to the KBDVECS structure.}

\function{short Kbrate(short delay, short reprate);}
\expl{Get or set keyboard repeat rate.}

\function{KEYTAB \*Keytbl(void \*nrml, void \*shft, void \*caps);}
\expl{Set the addresses of the keyboard mapping tables (-1 = don't change).}

\function{void \*Logbase();}
\expl{Get the start address of the logical display memory.}

\function{void Mfpint(short vnum, void \*vptr);}
\expl{Set the interrupt vectors of the MFP 68901 chip.}

\function{void Midiws(short cnt, void \*ptr);}
\expl{Write a sequence of {\sl cnt}+1 bytes to the MIDI-port.}

\function{void Offgibit(short ormask);}
\expl{Clear a bit in ``PORT A'' register of the GI chip.}

\function{void Ongibit(short andmask);}
\expl{Set a bit in ``PORT A'' register of the GI chip.}

\function{void \*Physbase();}
\expl{Get the start address of the physical display memory.}

\function{void Protobt(void \*buf, long serial, short dsktyp,
short exec);}
\expl{Create a boot sector in memory.}

\function{void Prtblk(void \*pblkptr);}
\expl{Special hardcopy routine, not unlike the {\bf Scrdmp()} routine.}

\function{long Random();}
\expl{Get a 24 bit random number.}

\function{long Rsconf(short baud, short flow, short uc, short
rs, short ts, short sc);}
\expl{Set the communication parameters for the serial port. The return
value is the current configuration of the four register of the UART.}

\function{void Scrdmp();}
\expl{Dump the current screen to the printer.}

\function{short Setcolor(short colornum, short color);}
\expl{Get ({\sl color} = -1) or set contents of color register.}

\function{void Setpalette(void \*palptr);}
\expl{Set the color palette of the video hardware.}
 
\function{short Setprt(short config);}
\expl{Get or set the current printer configuration.}

{\leftskip=\myindent The bits of the return value are assigned as
follows:\par}

\beginindentedkeys\beginthreecolumn
    \threecolrule{Bit}{Off}{On}
    \noalign{\hrule}
    \threecolrule{0}{Matrix-}{Daisy Wheel printer}
    \threecolrule{1}{color}{monochrom}
    \threecolrule{2}{Atari-}{Epson printer}
    \threecolrule{3}{Draft-}{High quality}
    \threecolrule{4}{Centronics-}{RS232 interface}
    \threecolrule{5}{Endless}{Single sheet paper}
\endthreecolumn\endindentedkeys

\function{void Setscreen(void \*lscrn, void \*pscrn, short rez);}
\expl{Set the logical and physical display memory start address and 
the current screen resolution.}
 
\function{void Settime(long time\_date);}
\expl{Set the hardware clock to {\sl time\_date}(lower word = time,
upper word = date.}

\function{void \*Ssbrk(short size);}
\expl{Reserve {\sl size} bytes at the end of the physical memory (Dummy
routine in all TOS versions).}

\function{long Supexec(void \*funcptr);}
\expl{Execute a subroutine in supervisor mode.}

\function{void Vsync();}
\expl{Wait until the verical blank interrupt has bitten.}

\function{void Xbtimer(short timer, short ctrl, long data, void \*vptr);}
\expl{Set and start the MFP 68901 timer.}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\section{XBIOS Calls unique to the TT}

I don't have more information about this calls at the moment. Can
someone please enlighten me.

\#include \<osbind.h>

\function{long Bconctl(short opcode, long operand);}
\expl{}

\function{long Bconmap(short dev);}
\expl{}

\function{void EgetPalette(short start, short count, word *palptr);}
\expl{Read parts or the complete TT color palette. Starting at
register {\sl start}, {\sl count} words are transfered to the word
field {\sl palptr}.}

\function{short EgetShift();}
\expl{Get the current contents of the videoshifter control register.}

\function{short EsetBank(short bank);}
\expl{Immediatly activate one of the 16 TT color banks and copy the
values to the ST(E) compatible color register.}

\function{short EsetColor(short num, short val);}
\expl{Set color register {\sl num} to the value {\sl val}. If {\sl
val}$ == -1$ the current value is returned.} 

\function{short EsetGray( short mode);}
\expl{Switch between color ({\sl mode} $== 0$) and gray scale presentation.}

\function{void EsetPalette(short start, short count, word *palptr);}
\expl{Change parts or the complete TT color palette. From the word
field {\sl palptr} {\sl count} color register are set, starting at
register {\sl start}.}

\function{void EsetShift(short mode);}
\expl{Set the videoshift control register and return the previous contents.}

\function{short EsetSmear(short mode);}
\expl{If {\sl mode}$ \ne 0$, the sample \& hold/smear mode is switched on.}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\section{LineA Calls}

\#include \<linea.h>

\function{void linea0();}
\expl{Initialize lineA.}

\function{void linea1();}
\expl{Put pixel.}

\function{int linea2();}
\expl{Get pixel.}

\function{void linea3();}
\expl{Draw line.}

\function{void linea4();}
\expl{Horizontal line.}

\function{void linea5();}
\expl{Draw rectangle.}

\function{void linea6();}
\expl{Filled polygon.}

\function{void linea7(BBPB \*ptr);}
\expl{Bit blit.}

\function{void linea8();}
\expl{Text blit.}

\function{void linea9();}
\expl{Show mouse.}

\function{void lineaa();}
\expl{Hide mouse.}

\function{void lineab();}
\expl{Mouse form.}

\function{void lineac(void \*ptr);}
\expl{Undraw sprite.}

\function{void linead(int x, int y, SFORM \*sprite, void \*ptr);}
\expl{Draw sprite.}

\function{void lineae();}
\expl{Copy raster.}

\function{void lineaf();}
\expl{Seed fill.}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\section{VT52 Escape Seqences}

\#include \<vt52.h>

\beginthreecolumn
  \threecolrule{Mnemonic}{\omit\hfil Sequence\hfil}{Meaning}
  \noalign{\hrule}
  \threecolrule{C\_UP}{ESC A}{cur. one line up}
  \threecolrule{C\_DOWN}{ESC B}{cur. one line down}
  \threecolrule{C\_RIGHT}{ESC C}{cur. one column right}
  \threecolrule{C\_LEFT}{ESC D}{cur. one column left}
  \threecolrule{CLEAR\_HOME}{ESC E}{clear screen, cur. home}
  \threecolrule{HOME}{ESC H}{cur. home}
  \threecolrule{SCROLL\_UP}{ESC I}{cur. one line up (scroll)}
  \threecolrule{CLEAR\_DOWN}{ESC J}{clear to end of screen}
  \threecolrule{DEL\_EOL}{ESC K}{clear until end of line}
  \threecolrule{INS\_LINE}{ESC L}{insert line}
  \threecolrule{DEL\_LINE}{ESC M}{delete line}
  \threecolrule{CURS\_LOC}{ESC Y\%c\%c}{set cur. to position}
  \threecolrule{CHAR\_COLOR}{ESC b\%c}{set char. color}
  \threecolrule{BG\_COLOR}{ESC c\%c}{set background color}
  \threecolrule{C\_ON}{ESC e}{switch cur. on}
  \threecolrule{C\_OFF}{ESC f}{switch cur. off}
  \threecolrule{C\_SAVE}{ESC j}{store cur. position}
  \threecolrule{C\_RESTORE}{ESC k}{restore cur. position}
  \threecolrule{ERASE\_L}{ESC l}{clear cur. line}
  \threecolrule{DEL\_BOL}{ESC o}{clear until beg. of line}
  \threecolrule{REV\_ON}{ESC p}{inverse on}
  \threecolrule{REV\_OFF}{ESC q}{inverse off}
  \threecolrule{WRAP\_ON}{ESC v}{automatic line wrap on}
  \threecolrule{WRAP\_OFF}{ESC w}{automatic line wrap off}
\endthreecolumn

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\section{System Variables and Magic Numbers}

\#include \<sysvars.h>

{\offinterlineskip
 \paralign{\strut#\hfil\quad&\hfil#\cr
  \twocol{Name}{\omit\hfil Address\hfil}\noalign{\vskip 3pt}
  \twocol{proc\_lives}{(unsigned long \*) 0x380}
  \twocol{etv\_timer}{(void (\*\*)()) 0x400}
  \twocol{etv\_critic}{(void (\*\*)()) 0x404}
  \twocol{etv\_term}{(void (\*\*)()) 0x408}
  \twocol{memvalid}{(unsigned long \*) 0x420}
  \twocol{mencntlr}{(unsigned char \*) 0x424}
  \twocol{resvalid}{(unsigned long \*) 0x426}
  \twocol{resvector}{(void (\*\*)()) 0x42a}
  \twocol{phystop}{(unsigned long \*) 0x42e}
  \twocol{\_membot}{(unsigned long \*) 0x432}
  \twocol{\_memtop}{(unsigned long \*) 0x436}
  \twocol{memval2}{(unsigned long \*) 0x43a}
  \twocol{flock}{(short \*) 0x43e}
  \twocol{seekrate}{(short \*) 0x440}
  \twocol{\_timr\_ms}{(short \*) 0x442}
  \twocol{\_fverify}{(short \*) 0x444}
  \twocol{\_bootdev}{(short \*) 0x446}
  \twocol{palmode}{(short \*) 0x448}
  \twocol{defshiftmd}{(unsigned char \*) 0x44a}
  \twocol{sshiftmd}{(short \*) 0x44c}
  \twocol{\_v\_bas\_ad}{(void \*) 0x44e}
  \twocol{vblsem}{short \*) 0x452}
  \twocol{nvbls}{(short \*) 0x454}
  \twocol{\_vblqueue}{(void (\*\*\*)()) 0x456}
  \twocol{colorptr}{(short \*\*) 0x45a}
  \twocol{\_vbclock}{(unsigned long \*) 0x462}
  \twocol{\_frclock}{(unsigned long \*) 0x466}
  \twocol{\_hz\_200}{(unsigned long \*) 0x4ba}
  \twocol{conterm}{\*((char \*) 0x484}
  \twocol{savptr}{(long \*) 0x4a2}
  \twocol{\_nflops}{(short \*) 0x4A6}
  \twocol{\_sysbase}{(long \*) 0x4f2}
  \twocol{\_shell\_p}{(long \*) 0x4f6}
  \twocol{pun\_ptr}{({\bf HDINFO} \*) 0x516}
  \twocol{\_p\_cookies}{(long \*\*) 0x5A0}
  \noalign{\vskip 3pt}
  \twocol{PROC\_LIVES\_MAGIC}{0x12345678L}
  \twocol{MEMVALID\_MAGIC}{0x752019F3L}
  \twocol{MEMVAL2\_MAGIC}{0x237698AAL}
  \twocol{RESVALID\_MAGIC}{0x31415926L}
}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\section{Error Numbers}

\#include \<errno.h>

{\offinterlineskip
 \paralign{\strut#\hfil\enskip&\hfil#\hfil\enskip&#\hfil\cr
  \threecol{ENOERR}{0}{no error}
  \threecol{E\_OK}{ENOERR}{}
  \threecol{EERROR}{1}{generic error}
  \threecol{EDRNRDY}{2}{drive not ready}
  \threecol{EDRVNR}{EDRNRDY}{}
  \threecol{EUKCMD}{3}{unknown command}
  \threecol{EUNCMD}{EUKCMD}{}
  \threecol{ECRC}{4}{crc error}
  \threecol{E\_CRC}{ECRC}{}
  \threecol{EBADREQ}{5}{bad request}
  \threecol{ESEEK}{6}{seek error}
  \threecol{E\_SEEK}{ESEEK}{}
  \threecol{EUKMEDIA}{7}{unknown media}
  \threecol{EMEDIA}{EUKMEDIA}{}
  \threecol{ESECTOR}{8}{sector not found}
  \threecol{ESECNF}{ESECTOR}{}
  \threecol{EPAPER}{9}{no paper}
  \threecol{EWRITE}{10}{write fault}
  \threecol{EWRITEF}{EWRITE}{}
  \threecol{EREAD}{11}{read fault}
  \threecol{EREADF}{EREAD}{}
  \threecol{EGENERIC}{12}{general mishap}
  \threecol{EROFS}{13}{write protect}
  \threecol{ECHMEDIA}{14}{media change}
  \threecol{E\_CHNG}{ECHMEDIA}{}
  \threecol{EUKDEV}{15}{unknown device}
  \threecol{EUNDEV}{EUKDEV}{}
  \threecol{EBADSEC}{16}{bad sectors}
  \threecol{ENBADSF}{EBADSEC}{}
  \threecol{EIDISK}{17}{insert disk}
  \threecol{EOTHER}{EIDISK}{}\noalign{\vskip 3pt}
  \threecol{EINVAL}{32}{invalid function number}
  \threecol{ENOENT}{33}{file not found}
  \threecol{ESRCH}{ENOENT}{pid not found}
  \threecol{EPATH}{34}{path not found}
  \threecol{EMFILE}{35}{too many open files}
  \threecol{EACCESS}{36}{access denied}
  \threecol{EACCES}{36}{access denied}
  \threecol{EPERM}{EACCESS}{}
  \threecol{EBADF}{37}{invalid handle}
  \threecol{ENOMEM}{39}{insufficient memory}
  \threecol{EFAULT}{40}{invalid memory block}
  \threecol{}{}{request}
  \threecol{ENXIO}{46}{invalid drive}
  \threecol{EXDEV}{48}{cross device rename}
  \threecol{ENMFILES}{49}{no more files (Fnext)}\noalign{\vskip 3pt}
  \threecol{ENMFIL}{ENMFILES}{}
  \threecol{ERANGE}{62}{range error}
  \threecol{EDOM}{63}{domain error}
  \threecol{EBADARG}{64}{range error}
  \threecol{}{}{/context unknown}
  \threecol{EINTERNAL}{65}{internal error}
  \threecol{EINTRN}{EINTERNAL}{}
  \threecol{ENOEXEC}{66}{invalid program}
  \threecol{}{}{load format}
  \threecol{EPLFMT}{ENOEXEC}{}
  \threecol{ESBLOCK}{67}{set block failed/}
  \threecol{}{}{growth restraints}
  \threecol{EGSBF}{ESBLOCK}{}
  \threecol{EEXIST}{80}{file exists (open)}
  \threecol{ENAMETOOLONG}{81}{file exists (open)}
  \threecol{ENOTTY}{82}{not a tty (ioctl)}
  \threecol{EAGAIN}{EDRNRDY}{try again later}
  \threecol{ENOTDIR}{EPATH}{\* preliminary \*}
}}

%\newcolumn

\copyrightnotice

\bye

% Local variables:
% auto-save-interval: 1024
% eval: (require 'gin-mode)
% eval: (gin-mode 1)
% eval: (auto-fill-mode 1)
% compile-command: "plain lib-card"
% End:
(sort-regexp-fields nil "\\\\function{[A-Za-z_\\~]+\\s *[\\\\*]*\\([A-Za-z_]+\\)\\([ -~]+
\\)+" "\\1" (region-beginning) (region-end))
