home *** CD-ROM | disk | FTP | other *** search
/ Simtel MSDOS 1992 September / Simtel20_Sept92.cdr / msdos / fido / maildmn.arc / MAILHDR.C < prev    next >
C/C++ Source or Header  |  1987-12-16  |  1KB  |  70 lines

  1. /*    
  2.     showmail:
  3. */
  4. #include <stdio.h>
  5. #include <dos.h>
  6. #include <string.h>
  7. #include <errno.h>
  8. #include <assert.h>
  9. #include <stddef.h>
  10. #include <stdlib.h>
  11.  
  12.  
  13. struct _msg 
  14. {
  15.     char from[36];
  16.     char to[36];
  17.     char subj[72];
  18.     char date[20];
  19.     int times;
  20.     int dest;
  21.     int orig;
  22.     int cost;
  23.     int caca[6];
  24.     unsigned reply;
  25.     int attr;
  26.     int up;
  27.     char content[4096];
  28. } msg;
  29.             
  30.    char msgbuffer[4091];
  31.    char mailfile[128];
  32.    char badname[36];
  33.  
  34.  
  35. void main(int, char*[]);
  36.  
  37. void main(argc, argv)
  38. int argc;
  39. char *argv[];
  40. {
  41.    int i;
  42.    char *c, *cme;
  43.    struct find_t ft;
  44.  
  45.    FILE *fp;
  46.  
  47.    strcpy(mailfile,"1.MSG");
  48.  
  49.    for(i=1; i<argc; i++) {
  50.     if (*(c=argv[i])=='-') ;
  51.     else {
  52.         strcpy(mailfile,c);
  53.         }
  54.     }
  55.  
  56.    if (!(fp=fopen(mailfile,"rb"))) {
  57.     printf("Error: %s not found\n",mailfile);
  58.     exit(1);
  59.     }
  60.    fread((void *)&msg,sizeof(msg),1,fp);
  61.    fclose(fp);
  62.  
  63.    printf("The fido-formatted mail message header to %s is:\n"
  64.     "To: %s\nFrom: %s\nRe: %s\nDate: %s\nRead %d times\n",
  65.     mailfile,msg.to,msg.from,msg.subj,msg.date,msg.times);
  66.  
  67.    
  68.    exit(0);
  69. }
  70.