Listing 7 (os.c)
/* Copyright (c) Robert Ramey 1991. All Rights Reserved */ #include <stdio.h> #include <signal.h> #include "psort.h" #include "os.h" /********************************************************************* os_init - initialize input/output **********************************************************************/ os_init(argc, argv) int argc; char *argv[]; { if(signal(SIGINT, SIG_DFL) == SIG_ERR) error("Couldn't establish ^C handler"); } /********************************************************************* error - takes control when aborted with ^C **********************************************************************/ void error(msg) char *msg; { fputs(msg, stderr); exit(1); } /********************************************************************* cbreak - takes control when aborted with ^C **********************************************************************/ /* void cbreak() { fputs("Aborted by Operator", stderr); exit(3); } */ /********************************************************************* os mavl - figure how much memory can be allocated **********************************************************************/ /* MEM SIZE os_mavl () { return (MEM_SIZE)_bios_memsize() / K; } */ /********************************************************************* os_flength - returns number of bytes in file **********************************************************************/ #include <io.h> FILE_SIZE os_flength(fptr) FILE *fptr; { return filelength(fileno(fptr)); } /* End of File */