home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 9 Archive / 09-Archive.zip / zoo21-2.zip / source / emx.c < prev    next >
C/C++ Source or Header  |  1992-09-20  |  1KB  |  59 lines

  1. /* @(#) msc.c 1.2 91/07/14 16:08:54 */
  2.  
  3. #include <stdio.h>        /* to get fileno() */
  4. #include <io.h>
  5. #include <stdlib.h>
  6. #include <signal.h>
  7.  
  8. #ifdef OS2
  9. #define INCL_BASE
  10. #include <os2.h>
  11. #else
  12. #include <dos.h>
  13. #endif
  14.  
  15. void dosname PARMS((char *, char *));
  16.  
  17. /****************
  18. function zootrunc() truncates a file at the current seek position.
  19. */
  20.  
  21. int zootrunc (f)
  22. FILE *f;
  23. {
  24.     int handle = fileno(f);
  25.     long pos = tell(handle);
  26.     if (pos == -1) 
  27.       return -1;
  28.     if (chsize(handle, pos) == -1)
  29.       return -1;
  30.     return fseek(f, pos, SEEK_SET);
  31. }
  32.  
  33. /****************
  34. Function fixfname() converts the supplied filename to a syntax
  35. legal for the host system.  It is used during extraction.
  36. */
  37.  
  38. char *fixfname(fname)
  39. char *fname;
  40. {
  41.     char tmpname[PATHSIZE];
  42.         if ( IsFileNameValid(fname) )
  43.       return(fname);
  44.     dosname (nameptr(fname), tmpname);
  45.     strcpy(fname,tmpname);
  46.     return(fname);
  47. }
  48.  
  49. void zooexit (int status)
  50. {
  51.     exit (status);
  52. }
  53.  
  54. void spec_init(void)
  55. {
  56.     signal (SIGINT, zooexit);        /* install our own Control-C handler */
  57.     signal (SIGBREAK, zooexit);        /* install our own Control-Break handler */
  58. }
  59.