home *** CD-ROM | disk | FTP | other *** search
- exit(n) int n;
- Exit a program; N is the program return value.
-
- getopt(argc, argv, optstr) char *argv[], *optstr;
- Parses a programs argument vector. The optstr argument lists all
- possible program options, e.g. "abc:d" says that there are four
- options: a, b, c, and d, with c requiring an argument. The function
- returns the option or EOF when no more are present. For options that
- require an argument, the argument is found in "optarg", a
- global char pointer. See a UNIX manual for more info.
-
- fprintf(fp, fmt, args) FILE *fp; char *fmt; int args;
- A printf that writes to a standard I/O file.
-
-
- printf(fmt, args) char *fmt; int args;
- A function that prints a formatted output string to standard output.
-
- fscanf(f, fmt, args) FILE *f; char *fmt; int *args;
- A scanf that reads a standard I/O file.
-
- scanf(fmt, args) char *fmt; int *args;
- A function that reads arguments from the keyboard.
-
- sscanf(s, fmt, args) char *s; char *fmt; int *args;
- A scanf that reads from the given string.
-
- fileno(s) FILE *s;
- Returns the TOS file descriptor associated with a standard I/O stream.
-
- fread(buf, sz, n, s) char *buf; FILE *s;
- Read a standard I/O stream into buf. The sz is the size of each
- element and n is the number of elements.
-
- fwrite(buf, sz, n, s) char *buf; FILE *s;
- Write buf onto a standard I/O stream. The sz is the size of each
- element and n is the number of elements.
-
- fseek(s, offset, mode) FILE *s; long offset;
- Seek to a particular location on a standard I/O stream. See TOS
- documentation.
-
- fclose(s) FILE *s;
- Close a standard I/O stream.
-
- char *
- fgets(b, n, f) char *b; int n; FILE *f;
- Read a string, at most n characters, into buffer b from stream f.
- Keeps the newline. Returns EOF if nothing is there.
-
- FILE *
- fopen(name, mode) char *name, *mode;
- Open a standard I/O stream. Modes can be "r" for read, "w" for write,
- "a" for append. Can also handle "CON:", "PRT:", and "AUX:" to
- get access to keyboard/console, printer, and auxiliary ports.
-
- fputs(s, f) char *s; FILE *f;
- Write a string onto a standard I/O stream.
-
- char *
- gets(b) char *b;
- Get a string from stdin. Drop the trailing newline. Returns EOF
- if nothing is there.
-
- getchar()
- Get a character from stdin. Returns EOF if nothing is there.
-
- getc(s) FILE *s;
- Get a character from a standard I/O stream. Returns EOF if nothing
- is there.
-
- putchar(c)
- Write a character onto stdout.
-
- puts(s) char *s;
- Write a string onto stdout. Adds a newline.
-
- putc(c, s) int c; FILE *s;
- Write a character onto the given standard I/O stream. This is a
- buffered write.
-
- fflush(s) FILE *s;
- Flush the output buffer associated with the standard I/O stream.
-
- dup(fd)
- A TOS routine to duplicate a file descriptor.
-
- exec(file, args, env, mode) char *file, *args, *env; int mode;
- Execute a program. The file argument is the path of the program
- to be executed. The args argument will form the programs argv[],
- it is like a string, except that the first byte must contain
- the length of the string (ask TOS why). I always use a mode of 0
- to load-and-run a program.
-
- getdir(buf, drive) char *buf;
- Get the current directory of a given drive. If drive = 0, use
- current drive. Drive = 1 implies A:, 2 B:, etc.
-
- listdir(pat, buf, mode) char *pat, *buf;
- List a directory. The pat argument is the pattern (e.g. *.C). The
- buf argument is a DTA buffer (see a TOS manual). This function is
- designed to be called many times, each call returning another match
- to the search pattern in buf. On the second and subsequent calls,
- pat should be NULL. A return of zero indicates success, non-zero
- indicates error or end. The mode argument also limits the search
- based on the files's attributes. I use 0 for files and 0x10 for
- directories. In the DTA buffer, bytes 30 through 43 are the program
- name.
-
-
- lseek(fd, offset, mode) int fd; long offset; int mode;
- Set the file pointer for the given file descriptor fd. If mode = 0,
- offset directly sets the file pointer. If mode = 1, offset is added
- to the current file pointer. If mode = 2, the file pointer is set
- offset bytes past the current end of the file.
-
- unlink(name) char *name;
- Remove the named file.
-
- close(fd)
- Close a file.
-
- creat(f, m) char *f;
- Create a file named f with attributes m.
-
- open(f, m) char *f;
- Open a file named f. If m = 0, read only. If m = 1, write only.
- If m = 3, read or write.
-
-
- read(fd, buf, sz) int fd, sz; char *buf;
- Read sz bytes of file fd into buffer buf starting at the current
- file pointer. This advances the file pointer sz bytes. Note, sz
- is an integer! Returns the number of bytes read.
-
- write(fd, buf, sz) int fd, sz; char *buf;
- Write sz bytes of buffer buf onto file fd.
-
- chmod(name, mode) char *name; int mode;
- Change the attributes of a file.
- * mode = 0x00 - normal file (read/write)
- * 0x01 - read only file
- * 0x02 - hidden file
- * 0x04 - system file
- * 0x08 - file is volume label
- * 0x10 - file is a subdirectory
- * 0x20 - file is written and closed correctly
-
- sprintf(buf, fmt, args) char *buf, *fmt; int args;
- A printf that stores the formatted output into buf instead of
- writing it out.
-
- char *
- realloc(r, n) struct header *r; unsigned n;
- Change the size of a malloc'ed piece of memory.
-
- char *
- calloc(n, sz) unsigned n, sz;
- Allocate sz bytes and zero them out.
-
- char *
- malloc(n) unsigned n; {
- Allocate n bytes from the system.
-
- free(r) struct header *r;
- Return a previously allocated piece of memory back to the system.
-
- char *
- strcat(s1, s2) char *s1, *s2; {
- Concatenate string s2 onto string s1. Returns a pointer to s1.
-
- char *
- strncat(s1, s2, n) char *s1, *s2; int n;
- Concatenate string s2 onto string s1, which is no more than n bytes
- long.
-
- strcmp(s1, s2) char *s1, *s2;
- Compare string s1 to string s2. Returns less than, equal, or greater
- than zero if the s1 is less than, equal, or greater than s2.
-
- strncmp(s1, s2, n) char *s1, *s2; int n;
- Same as strcmp, except that it only looks at n characters.
-
- char *
- strcpy(s1, s2) char *s1, *s2;
- Copy string s2 into string s1;
-
- char *
- strncpy(s1, s2, n) char *s1, *s2; int n;
- Same as strcpy except it copies at most n characters.
-
- strlen(s) char *s;
- Returns the length of a string.
-
- char *
- strchr(s, c) char *s; int c;
- Searches string s for character c. Returns a pointer to the
- first occurence or NULL if not found.
-
- char *
- strrchr(s, c) char *s; int c;
- Same as strchr(), except it searches from the end of the string
- towards the beginning.
-
- char *
- strpbrk(s1, s2) unsigned char *s1, *s2;
- Scans over the string in s1 looking for characters in string s2.
- Stops at the first occurence and returns a pointer to its location.
- Returns NULL if it didn't find anything.
-
- char *
- strtok(s1, s2) unsigned char *s1, *s2;
- Tokenizes a string s1. The first call should have a non-NULL s1,
- which is remembered on subsequent calls. String s2 contains the
- token separators.
-
- strspn(s1, s2) unsigned char *s1, *s2;
- Skips over the string s1 as long as it contains the characters
- found in string s2. Returns a pointer into s1.
-
- strcspn(s1, s2) unsigned char *s1, *s2;
- Same as strspn, except the inverse condition (i.e. skips s1 as long
- as it does not contain s2 characters).
-
- long
- strtol(s, p, base) char *s, **p;
- Convert a number in a string to a (long) integer. Handles octal
- and hex constants as well as decimal. If p is non-NULL, the end
- of the number is stored there.
- char *
- strlower(s) char *s;
- Convert all uppercase characters in s to lowercase.
-
- char *
- strupper(s) char *s;
- Convert all lowercase characters in s to uppercase.
-
- memcpy(m1, m2, n) char *m1, *m2;
- Copy n bytes from m2 to m1.
-
- long
- time(tloc) long *tloc;
- Return the number of seconds since 1980. If tloc is non-nil, then
- the value is stored there as well.
-
- getdate()
- gettime()
- Get the current date and time in TOS format.
-
- setjmp(buf) char **buf;
- Initializes a buffer to allow one to do a non-local goto.
- See a UNIX manual.
-
- longjmp(buf, rc) char **buf;
- Actually do the non-local goto.
-
-