home *** CD-ROM | disk | FTP | other *** search
/ vsiftp.vmssoftware.com / VSIPUBLIC@vsiftp.vmssoftware.com.tar / FREEWARE / FREEWARE40.ZIP / flistfrontend / src / syfom.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-06-06  |  1.1 KB  |  61 lines

  1. #ifndef NO_IDENT
  2. static char *Id = "$Id: syfom.c,v 1.5 1995/06/06 13:46:52 tom Exp $";
  3. #endif
  4.  
  5. /*
  6.  * Title:    sysfom.c - Display figures-of-merit
  7.  * Author:    Thomas E. Dickey
  8.  * Created:    27 Oct 1983
  9.  * Last update:
  10.  *        19 Feb 1995, prototypes
  11.  *        27 Oct 1983
  12.  *
  13.  * Function:    Obtain a character string from the operating system which
  14.  *        shows both elapsed and actual CPU times.  Return this string
  15.  *        to the user for inclusion in the process-listing.
  16.  *
  17.  * Parameters:    co_    => caller's output buffer.  If null pointer, initialize
  18.  *               timer-control-block.
  19.  */
  20.  
  21. #include    <lib$routines.h>
  22. #include    <string.h>
  23.  
  24. #include "sysutils.h"
  25.  
  26. static    char    bfr[256];
  27. static    char    *handle_ = 0;
  28. static    int    code    = 0;
  29.  
  30. #define SYSFOM_DATA struct _sysfom_data
  31. SYSFOM_DATA {
  32.     short len;
  33.     short typ;
  34.     char  *c_;
  35.     };
  36.  
  37. static void
  38. sysfom_x (SYSFOM_DATA *dx_)
  39. {
  40.     int    len    = dx_->len;
  41.     char    *c_    = dx_->c_;
  42.  
  43.     strncpy (bfr, dx_->c_, len);
  44.     bfr[len] = '\0';
  45. }
  46.  
  47. /*
  48.  * Main procedure:
  49.  */
  50. void
  51. sysfom (char *co_)
  52. {
  53.     if ((co_ == 0) || (handle_ == 0))
  54.         lib$init_timer(&handle_);
  55.     if (co_)
  56.     {
  57.         lib$show_timer (&handle_, &code, sysfom_x);
  58.         strcpy (co_, &bfr[1]);
  59.     }
  60. }
  61.