home *** CD-ROM | disk | FTP | other *** search
/ Piper's Pit BBS/FTP: ibm 0010 - 0019 / ibm0010-0019 / ibm0010.tar / ibm0010 / PROCWRKB.ZIP / BENCH1.ZIP / HELP / HELPMISC.C < prev    next >
Encoding:
C/C++ Source or Header  |  1990-08-07  |  1.1 KB  |  55 lines

  1. /* ==( bench/helpmisc.c )== */
  2. /* ----------------------------------------------- */
  3. /* Pro-C  Copyright (C) 1988 - 1990 Vestronix Inc. */
  4. /* Modification to this source is not supported    */
  5. /* by Vestronix Inc.                               */
  6. /*            All Rights Reserved                  */
  7. /* ----------------------------------------------- */
  8. /* Written   RN   15-Jan-90                        */
  9. /* ----------------------------------------------- */
  10. /* %W%  (%H% %T%) */
  11.  
  12. /*
  13.  *  Modifications
  14.  *
  15. */
  16.  
  17. # include <stdio.h>
  18. # include <bench.h>
  19. # include <fileio.h>
  20. # include <errno.h>
  21.  
  22. # include "help.h"
  23.  
  24. char StatSizeErr_d[] = "fsize() : Error getting status on index file (%d)";
  25.  
  26. PROTO (long fsize, (int));
  27. PROTO (void stripext, (char *));
  28.  
  29. long fsize(fd)
  30.     int fd;
  31. {
  32.     long file_length, curpos;
  33.  
  34.     curpos = lseek(fd, 0L, SEEK_CUR);
  35.  
  36.     file_length = lseek(fd, 0L, SEEK_END);
  37.  
  38.     lseek(fd, curpos, SEEK_SET);
  39.  
  40.     return(file_length);
  41. }
  42.  
  43. long file_time(path)
  44.     char *path;
  45. {
  46.     struct stat sbuf;
  47.  
  48.     if (STAT(path, &sbuf) == -1)
  49.     {
  50.         errmsg(StatSizeErr_d, errno);
  51.         return(-1L);
  52.     }
  53.     return(sbuf.st_mtime);
  54. }
  55.