home *** CD-ROM | disk | FTP | other *** search
/ ftp.uv.es / 2014.11.ftp.uv.es.tar / ftp.uv.es / pub / unix / aix-rs6000 / elm2.3.11.AIX3.1.5.Z / elm2.3.11.AIX3.1.5 / src / mailtime.c < prev    next >
C/C++ Source or Header  |  1990-04-28  |  3KB  |  83 lines

  1.  
  2. static char rcsid[] = "@(#)$Id: mailtime.c,v 4.1 90/04/28 22:43:31 syd Exp $";
  3.  
  4. /*******************************************************************************
  5.  *  The Elm Mail System  -  $Revision: 4.1 $   $State: Exp $
  6.  *
  7.  *             Copyright (c) 1986, 1987 Dave Taylor
  8.  *             Copyright (c) 1988, 1989, 1990 USENET Community Trust
  9.  *******************************************************************************
  10.  * Bug reports, patches, comments, suggestions should be sent to:
  11.  *
  12.  *    Syd Weinstein, Elm Coordinator
  13.  *    elm@DSI.COM            dsinc!elm
  14.  *
  15.  *******************************************************************************
  16.  * $Log:    mailtime.c,v $
  17.  * Revision 4.1  90/04/28  22:43:31  syd
  18.  * checkin of Elm 2.3 as of Release PL0
  19.  * 
  20.  *
  21.  ******************************************************************************/
  22.  
  23. /** This set of routines is used to figure out when the user last read
  24.     their mail and to also figure out if a given message is new or not.
  25.  
  26. **/
  27.  
  28. #include "headers.h"
  29.  
  30. #include <sys/types.h>
  31. #include <sys/stat.h>
  32. #ifdef I_TIME
  33. #  include <time.h>
  34. #endif
  35. #ifdef I_SYSTIME
  36. #  include <sys/time.h>
  37. #endif
  38.  
  39. resolve_received(entry)
  40. struct header_rec *entry;
  41. {
  42.     /** Entry has the data for computing the time and date the 
  43.         message was received.  Fix it and return **/
  44.  
  45.     switch (tolower(entry->month[0])) {
  46.       case 'j' : if (tolower(entry->month[1]) == 'a')
  47.                entry->received.month = JANUARY;
  48.              else if (tolower(entry->month[2]) == 'n')
  49.                    entry->received.month = JUNE;
  50.              else
  51.                    entry->received.month = JULY;
  52.                  break;
  53.       case 'f' : entry->received.month = FEBRUARY;
  54.               break;
  55.       case 'm' : if (tolower(entry->month[2]) == 'r')
  56.                    entry->received.month = MARCH;
  57.              else
  58.                entry->received.month = MAY;
  59.                  break;
  60.       case 'a' : if (tolower(entry->month[1]) == 'p')
  61.                    entry->received.month = APRIL;
  62.                  else
  63.                    entry->received.month = AUGUST;
  64.              break;
  65.       case 's' : entry->received.month = SEPTEMBER;
  66.              break;
  67.       case 'o' : entry->received.month = OCTOBER;
  68.              break;
  69.       case 'n' : entry->received.month = NOVEMBER;
  70.                break;
  71.       case 'd' : entry->received.month = DECEMBER;
  72.              break;
  73.     }
  74.  
  75.     sscanf(entry->day, "%d", &(entry->received.day));
  76.  
  77.     sscanf(entry->year, "%d", &(entry->received.year));
  78.     if (entry->received.year > 100) entry->received.year -= 1900;
  79.  
  80.     sscanf(entry->time, "%d:%d", &(entry->received.hour),
  81.            &(entry->received.minute));
  82. }
  83.