home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / bbs / waffle / 5630 < prev    next >
Encoding:
Text File  |  1992-12-29  |  1.9 KB  |  68 lines

  1. Path: sparky!uunet!micro-c!eastwind!entropy!morpheus
  2. From: morpheus <morpheus@entropy.mcds.com>
  3. Newsgroups: comp.bbs.waffle
  4. Subject: something that you'll never use...
  5. Message-ID: <B0kiwB1w165w@entropy.mcds.com>
  6. Date: Mon, 28 Dec 92 17:49:34 EST
  7. Organization: No Pity For The Majority!  [private]
  8. Lines: 58
  9.  
  10. Short C source follows for a program to display the last connect times for
  11. sites you talk to.  For DOS waffle.  Run it in your /spool/status dir.  I take
  12. no responsibility for anything, particularly anything related to overwriting
  13. other data or tornados.  Written for a Borland compiler.
  14.  
  15. I'm not quite sure why I'm posting this, it just seems to be what people do
  16. with this kind of stuff...  I put it in an extern file so bored users can
  17. look at it, along with the output of stats.  Go figure.
  18.  
  19. /* shstatus.c */
  20. #include <stdio.h>
  21. #include <time.h>
  22. #include <string.h>
  23. #include <stdlib.h>
  24. #include <dir.h>
  25.  
  26. void main()
  27. {
  28.     FILE *fp;
  29.     unsigned long ntime;
  30.     struct tm *tst;
  31.     char line[11];
  32.     char *site;
  33.     char *tmp;
  34.     struct ffblk *fin;
  35.     int result;
  36.     int i;
  37.  
  38.     ntime = time(0);
  39.     tst = localtime(&ntime);
  40.  
  41.     printf("Connection status as of %s\n",asctime(tst));
  42.     printf("site    \t\tlast connect\n");
  43.     printf("----    \t\t------------\n");
  44.  
  45.     result = findfirst("*",fin,0);
  46.  
  47.     while(result != -1) {
  48.         fp = fopen(fin->ff_name,"r");
  49.         if(!fp) return;
  50.         fgets(line,10,fp);
  51.         *(strchr(line,' ')) = 0;
  52.         ntime = strtoul(line,0,10);
  53.         tst = localtime(&ntime);
  54.         site = fin->ff_name;
  55.         for(i=8-strlen(site);i>0;i--) {
  56.             *(strchr(site,0)+1) = 0;
  57.             *(strchr(site,0)) = ' ';
  58.         }
  59.         printf("%s\t\t%s",strupr(site),asctime(tst));
  60.         result = findnext(fin);
  61.     }
  62. }
  63.  
  64.  
  65.  
  66. morpheus@entropy.mcds.com ("morph")    |    My life is for itself, and not a
  67. Obsolete diety for hire.  Cheap.       |         spectacle.  - Emerson
  68.