home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 1 / 1431 < prev    next >
Internet Message Format  |  1990-12-28  |  2KB

  1. From: vail@tegra.COM (Johnathan Vail)
  2. Newsgroups: comp.lang.postscript,alt.sources
  3. Subject: Re: Pcal: postscript/c calendar printer (Casio BOSS Conversion)
  4. Message-ID: <1012@atlas.tegra.COM>
  5. Date: 8 Jun 90 15:43:50 GMT
  6.  
  7.  
  8.  
  9. Here is a small hack I made for use with the pcal program recently
  10. posted.  It will filter a file from the Casio BOSS (the little
  11. calculator sized memory/phone-list/schedule gizmos) and produce lines
  12. for schedule items for the pcal program.
  13.  
  14. Shar and Enjoy, jv
  15.  
  16. "Frisbeetarianism is the belief that when you die, your soul goes up on
  17. the roof and gets stuck." -- button
  18.  _____
  19. |     | Johnathan Vail | n1dxg@tegra.com
  20. |Tegra| (508) 663-7435 | N1DXG@448.625-(WorldNet)
  21.  -----  jv@n1dxg.ampr.org {...sun!sunne ..uunet}!tegra!vail
  22.  
  23. --------------------------->8 cut here 8<----------------------------
  24. /*
  25. **    boss2cal - Convert Casio BOSS file dates to calender files.
  26. **
  27. **    Written  6 Jun 1990, Johnathan Vail, N1DXG  vail@tegra.com
  28. **
  29. **    This program will filter a file from a Casio BOSS into a file
  30. ** suitable for use with the pcal program to generate postscript
  31. ** calenders.
  32. **
  33. */
  34.  
  35.  
  36.  
  37. #include <stdio.h>
  38.  
  39.  
  40.  
  41. void boss_convert_date(char *in_line, char *out_line)
  42. {
  43.     char *start_time, *end_time, *date, *year;
  44.     char *lp, *event;
  45.     char time_buf[50];
  46.  
  47.     for(lp=in_line; *lp; lp++)
  48.     if (*lp=='\t' || *lp=='\r')
  49.         *lp='\0';
  50.  
  51.     if (strncmp(in_line,":0300",5)==0) {
  52.     in_line[9]='\0';
  53.     year=in_line+5;
  54.     date=in_line+10;
  55.  
  56.     start_time=end_time=in_line+16;
  57.  
  58.     while(*end_time++);
  59.  
  60.     event=end_time;
  61.     while (*event++);
  62.     while (*event++);    /* skip over alarm time        */
  63.  
  64.     for(lp=event; *lp; lp++)
  65.         if (*lp=='\\' && *(lp+1)=='0') {
  66.         *lp=' ';
  67.         *++lp=' ';
  68.         *++lp=' ';
  69.         }
  70.  
  71.     sprintf(time_buf,"%s%s%s",
  72.         start_time,
  73.         (*end_time?" to ":""),
  74.         end_time);
  75.  
  76.     sprintf(out_line,"%s-%s %s %s",
  77.         date,
  78.         year,
  79.         time_buf,
  80.         event);
  81.     }
  82.     else {
  83.     *out_line='\0';
  84.     }
  85. }
  86.  
  87.  
  88.  
  89. main()
  90. {
  91.     char in_line[380], out_line[380];
  92.  
  93.     while(gets(in_line)) {
  94.     if (!*in_line) break;
  95.     boss_convert_date(in_line, out_line);
  96.     if (*out_line)
  97.         printf("%s\n",out_line);
  98.     }
  99.     exit(0);
  100. }
  101.     
  102.