home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume36 / getwxmap / patch01 next >
Text File  |  1993-03-24  |  13KB  |  426 lines

  1. Newsgroups: comp.sources.misc
  2. From: rodmur@ecst.csuchico.edu (Dale Harris)
  3. Subject: v36i069:  getwxmap - Retrieve and display Weather satellite maps, Patch01
  4. Message-ID: <1993Mar25.052147.7648@sparky.imd.sterling.com>
  5. X-Md4-Signature: 1a06e56216f2d9dd9463d444a30c8ea4
  6. Date: Thu, 25 Mar 1993 05:21:47 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: rodmur@ecst.csuchico.edu (Dale Harris)
  10. Posting-number: Volume 36, Issue 69
  11. Archive-name: getwxmap/patch01
  12. Environment: X11, UNIX, xv
  13. Patch-To: getwxmap: Volume 35, Issue 115
  14.  
  15. [ This patch is late getting out because the moderator wasn't ]
  16. [ paying attention.  Sorry for the delay.          -Kent+     ]
  17.  
  18. This is patch to upgrade getwxmap ver. 2.3.1 to ver. 2.3.2
  19.  
  20. Getwxmap is a small program that retrieves the most recent satellite
  21. images from vmd.cso.uiuc.edu and then displays them (someday I'll build in
  22. support for a European site I heard about, but I haven't got to that yet.)
  23.  
  24. *** Makefile.orig    Tue Mar 16 18:40:44 1993
  25. --- Makefile    Tue Mar 16 18:13:32 1993
  26. ***************
  27. *** 1,6 ****
  28.   #
  29. ! # Makefile for getwxmap.c ver 2.3.1
  30. ! # Copyright (C) February 10, 1993 by Dale A. Harris
  31.   #                                {rodmur@ecst.csuchico.edu}
  32.   #
  33.   #CC=gcc
  34. --- 1,6 ----
  35.   #
  36. ! # Makefile for getwxmap.c ver 2.3.2
  37. ! # Copyright (C) March 11, 1993 by Dale A. Harris
  38.   #                                {rodmur@ecst.csuchico.edu}
  39.   #
  40.   #CC=gcc
  41. ***************
  42. *** 14,32 ****
  43.   #     good old fashioned C.
  44.   #
  45.   
  46. ! #CFLAGS= -g  # for debugging 
  47.   #CFLAGS=-O #most machines in this world
  48.   #CFLAGS=-O2  #for gcc
  49. ! CFLAGS= +O3 # with cc on HP9000/7xx-series running HPUX 8.*
  50.   
  51.   #Setting a domain is no longer neccessary
  52.   DEFINES= -DSYSV 
  53.   
  54.   #If you need any libs
  55.   #LIBS= -lmalloc #for HPUX if you like
  56. ! LIBS= -lmalloc
  57.   
  58. ! getwxmap: getwxmap.c
  59.       $(CC) $(CFLAGS) -o getwxmap $(DEFINES) getwxmap.c $(LIBS)
  60.   
  61.   clean:
  62. --- 14,33 ----
  63.   #     good old fashioned C.
  64.   #
  65.   
  66. ! CFLAGS= -g  # for debugging 
  67.   #CFLAGS=-O #most machines in this world
  68.   #CFLAGS=-O2  #for gcc
  69. ! #CFLAGS= +O3 # with cc on HP9000/7xx-series running HPUX 8.*
  70.   
  71.   #Setting a domain is no longer neccessary
  72. + #DEFINES= -DSYSV -DNO_STRDUP 
  73.   DEFINES= -DSYSV 
  74.   
  75.   #If you need any libs
  76.   #LIBS= -lmalloc #for HPUX if you like
  77. ! LIBS= 
  78.   
  79. ! getwxmap: getwxmap.c getwxmap.h
  80.       $(CC) $(CFLAGS) -o getwxmap $(DEFINES) getwxmap.c $(LIBS)
  81.   
  82.   clean:
  83. *** README.orig    Tue Mar 16 18:40:44 1993
  84. --- README    Thu Mar 11 15:51:43 1993
  85. ***************
  86. *** 1,6 ****
  87. --- 1,9 ----
  88.   Check out the Makefile, if your on a SYSV machine you might want to
  89.   -DSYSV, check out the #define fields also in getwxmap.h
  90.   
  91. + If you don't have strdup() on your system, define -DNO_STRDUP in the
  92. + Makefile.
  93.   If you find any bugs or have any suggestions e-mail:
  94.   rodmur@ecst.csuchico.edu
  95.   
  96. *** getwxmap.1.orig    Tue Mar 16 18:40:44 1993
  97. --- getwxmap.1    Tue Mar 16 18:41:36 1993
  98. ***************
  99. *** 11,20 ****
  100.   .SH OPTIONS
  101.   .TP
  102.   .B \-D
  103. ! don't display file (implies -R).
  104.   .TP
  105.   .B \-R
  106. ! don't remove file when program finishes.
  107.   .TP
  108.   .B \-d
  109.   debugging (implies -f).
  110. --- 11,20 ----
  111.   .SH OPTIONS
  112.   .TP
  113.   .B \-D
  114. ! don't display file, file won't be removed unless -R is used.
  115.   .TP
  116.   .B \-R
  117. ! don't remove file when program finishes.  Except with -x and -D.
  118.   .TP
  119.   .B \-d
  120.   debugging (implies -f).
  121. ***************
  122. *** 42,49 ****
  123.   .TP
  124.   .B \-x [xv options]
  125.   Must be last argument.  All arguments following -x are passed
  126. ! as command line arguments to xv.  Use this to get a background. (Implies
  127. ! -R)
  128.   .SH SEE ALSO
  129.   .BR xv (1V),
  130.   .SH AUTHOR
  131. --- 42,49 ----
  132.   .TP
  133.   .B \-x [xv options]
  134.   Must be last argument.  All arguments following -x are passed
  135. ! as command line arguments to xv.  Use this to get a background. If -R is
  136. ! used with this option the files retrieved will be deleted.
  137.   .SH SEE ALSO
  138.   .BR xv (1V),
  139.   .SH AUTHOR
  140. *** getwxmap.c.orig    Tue Mar 16 18:40:44 1993
  141. --- getwxmap.c    Tue Mar 16 18:26:25 1993
  142. ***************
  143. *** 21,31 ****
  144. --- 21,35 ----
  145.   2/12/93 - added -m option for mos*.gif maps (d.a.h)
  146.   2/19/93 - added files variable - dah
  147.   
  148. + 3/11/93 - fixed stupid little bug where SA.GIF was retrieve everytime,
  149. +          put in strdup() for those that don't have it. - dah
  150. + 3/16/93 - changed -R will trigger removal of files with -x and -D - dah
  151.   */
  152.   
  153.   #include "getwxmap.h"
  154.   
  155.   
  156. + int
  157.   main (argc, argv)
  158.        int argc;
  159.        char **argv;
  160. ***************
  161. *** 37,43 ****
  162.     char *mnthday, *gmt, *wgifs, *dispstr, *command, *filename, *uhour;
  163.     char *tmp_char1, *tmp_char2;
  164.     char *my_host, *xvargs;    /* hostname and xv arguments */
  165. !   register short surface = 0, visible = 0, infrared = 0, nodis = 0, norm = 0,
  166.       debug = 0, upair = 0, keymap = 0, echoname = 0, mos = 0, i, j;
  167.     short hpa[UMAPNO];
  168.     struct hostent *my_site;    /* to get the site name */
  169. --- 41,47 ----
  170.     char *mnthday, *gmt, *wgifs, *dispstr, *command, *filename, *uhour;
  171.     char *tmp_char1, *tmp_char2;
  172.     char *my_host, *xvargs;    /* hostname and xv arguments */
  173. !   short surface = 0, visible = 0, infrared = 0, nodis = 0, norm = 0, xvflg = 0,
  174.       debug = 0, upair = 0, keymap = 0, echoname = 0, mos = 0, i, j;
  175.     short hpa[UMAPNO];
  176.     struct hostent *my_site;    /* to get the site name */
  177. ***************
  178. *** 120,125 ****
  179. --- 124,130 ----
  180.         ++echoname;
  181.         break;
  182.       case 'x':        /* grab the rest into xvargs and run... */
  183. +       ++xvflg;
  184.         while (i < argc - 1)
  185.           {
  186.             strcat (xvargs, argv[++i]);
  187. ***************
  188. *** 126,132 ****
  189.             strcat (xvargs, " ");
  190.           }
  191.         j = strlen (argv[i]);    /* to break from j loop */
  192. -       ++norm;
  193.         break;
  194.       default:
  195.         fprintf (stderr, "%s: Bad Option: %c\n", argv[0], argv[i][j]);
  196. --- 131,136 ----
  197. ***************
  198. *** 134,162 ****
  199.         exit (1);
  200.       }
  201.     if (strlen (xvargs) == 0)
  202. !     strcat (xvargs, " ");    /* empty string */
  203.   
  204.     /* getting the time */
  205.     otp = tp = thetime ((time_t) 0, tp, argv[0]);
  206.     strftime (gmt, SMAX, "%m%d%H", tp);
  207.   
  208.     if (surface)
  209. -     strcat (wgifs, " SA.GIF ");
  210. -   tmp_char1 = (char *) strdup (wgifs);
  211. -   if (tp->tm_min >= SMAPMINMADE)
  212. -     sprintf (wgifs, "%s SA%s.GIF ", tmp_char1, gmt);
  213. -   else
  214.       {
  215. !       fprintf (stderr, "%s: SA%s.GIF not made until %d past the hour, getting last hours map.\n", argv[0], gmt, SMAPMINMADE);
  216. !       /* Take off an hour's worth of seconds if before the quarter hour */
  217. !       tp = thetime ((time_t) 3600, tp, argv[0]);
  218. !       strftime (gmt, SMAX, "%m%d%H", tp);
  219. !       sprintf (wgifs, "%s SA%s.GIF ", tmp_char1, gmt);
  220. !       tptmp = tp;
  221. !       tp = otp;
  222. !       free (tptmp);
  223.       }
  224. -   free (tmp_char1);
  225.     if (infrared)
  226.       strcat (wgifs, " CIR.GIF ");
  227.     if (visible)
  228. --- 138,174 ----
  229.         exit (1);
  230.       }
  231.     if (strlen (xvargs) == 0)
  232. !     {
  233. !       strcat (xvargs, " ");    /* empty string */
  234. !       xvflg = 0;
  235. !     }
  236.   
  237. +   if (nodis || xvflg)
  238. +     norm = (!norm);        /* if -R set, then remove, else don't */
  239.     /* getting the time */
  240.     otp = tp = thetime ((time_t) 0, tp, argv[0]);
  241.     strftime (gmt, SMAX, "%m%d%H", tp);
  242.   
  243.     if (surface)
  244.       {
  245. !       strcat (wgifs, " SA.GIF ");
  246. !       tmp_char1 = (char *) strdup (wgifs);
  247. !       if (tp->tm_min >= SMAPMINMADE)
  248. !     sprintf (wgifs, "%s SA%s.GIF ", tmp_char1, gmt);
  249. !       else
  250. !     {
  251. !       fprintf (stderr, "%s: SA%s.GIF not made until %d past the hour, getting last hours map.\n", argv[0], gmt, SMAPMINMADE);
  252. !       /* Take off an hour's worth of seconds if before the quarter hour */
  253. !       tp = thetime ((time_t) 3600, tp, argv[0]);
  254. !       strftime (gmt, SMAX, "%m%d%H", tp);
  255. !       sprintf (wgifs, "%s SA%s.GIF ", tmp_char1, gmt);
  256. !       tptmp = tp;
  257. !       tp = otp;
  258. !       free (tptmp);
  259. !     }
  260. !       free (tmp_char1);
  261.       }
  262.     if (infrared)
  263.       strcat (wgifs, " CIR.GIF ");
  264.     if (visible)
  265. ***************
  266. *** 283,289 ****
  267.         system (dispstr);
  268.       }
  269.   
  270. !       if (!norm && !nodis)
  271.       {
  272.         filename = strtok (wgifs, " ");
  273.         while (filename != (char *) NULL)
  274. --- 295,301 ----
  275.         system (dispstr);
  276.       }
  277.   
  278. !       if (!norm)
  279.       {
  280.         filename = strtok (wgifs, " ");
  281.         while (filename != (char *) NULL)
  282. ***************
  283. *** 294,300 ****
  284.           }
  285.       }
  286.       }
  287. !   exit (0);
  288.   }
  289.   
  290.   struct tm *
  291. --- 306,312 ----
  292.           }
  293.       }
  294.       }
  295. !   return 0;
  296.   }
  297.   
  298.   struct tm *
  299. ***************
  300. *** 323,331 ****
  301.   void
  302.   usage ()
  303.   {
  304. !   fputs ("Usage: getwxmap [ -RDdfsrmvku#x [xv options] ]\n", stderr);
  305. !   fputs ("-D if you don't want the files displayed (implies -R)\n", stderr);
  306. !   fputs ("-R if you don't want the files removed after displaying\n", stderr);
  307.     fputs ("-d for debugging (implies -f)\n", stderr);
  308.     fputs ("-f echos names of successfully retrieved files to standard out\n", stderr);
  309.     fputs ("-s For the Surface Anaylsis map\n", stderr);
  310. --- 335,343 ----
  311.   void
  312.   usage ()
  313.   {
  314. !   fputs ("Usage: getwxmap [ -RDdfsrmvku#x <xv options> ]\n", stderr);
  315. !   fputs ("-D if you don't want the files displayed, using with -R will remove files\n", stderr);
  316. !   fputs ("-R don't remove after displaying, except with -x and -D\n", stderr);
  317.     fputs ("-d for debugging (implies -f)\n", stderr);
  318.     fputs ("-f echos names of successfully retrieved files to standard out\n", stderr);
  319.     fputs ("-s For the Surface Anaylsis map\n", stderr);
  320. ***************
  321. *** 335,341 ****
  322.     fputs ("-k for the WX key map (note: this picture doesn't change)\n", stderr);
  323.     fputs ("-u# for the Upper Air maps at a # * 100 hPa itervals\n", stderr);
  324.     fputs ("(# = 2,3,5,7,8 for 200hPa, 300hPa, 500hPa, 700hPa, 800hPa respectively)\n", stderr);
  325. !   fputs ("-x [xv options]  Pass ALL arguments that follow to XV as command line\n", stderr);
  326. !   fputs ("options.  This option MUST come last.  Use this to get a background. (implies -R)\n", stderr);
  327.     return;
  328.   }
  329. --- 347,367 ----
  330.     fputs ("-k for the WX key map (note: this picture doesn't change)\n", stderr);
  331.     fputs ("-u# for the Upper Air maps at a # * 100 hPa itervals\n", stderr);
  332.     fputs ("(# = 2,3,5,7,8 for 200hPa, 300hPa, 500hPa, 700hPa, 800hPa respectively)\n", stderr);
  333. !   fputs ("-x [xv <options>]  Pass ALL arguments that follow to XV as command line\n", stderr);
  334. !   fputs ("    <options>. This option MUST come last. Use this to get a background.\n", stderr);
  335. !   fputs ("      Files will not be removed unless -R is used.\n", stderr);
  336.     return;
  337.   }
  338. + #ifdef NO_STRDUP
  339. + char *
  340. + strdup (s)
  341. + {
  342. +   char *t;
  343. +   t = malloc (strlen (s) + 1);
  344. +   strcpy (t, s);
  345. +   return (t);
  346. + }
  347. + #endif
  348. *** getwxmap.h.orig    Tue Mar 16 18:40:44 1993
  349. --- getwxmap.h    Tue Mar 16 18:38:08 1993
  350. ***************
  351. *** 1,5 ****
  352.   /*
  353. !  @(#) getwxmap 2.3.1, February 19, 1993
  354.   
  355.    Copyright (C) 1993, Dale A. Harris (rodmur@ecst.csuchico.edu)
  356.   
  357. --- 1,5 ----
  358.   /*
  359. !  @(#) getwxmap 2.3.2, March 11, 1993
  360.   
  361.    Copyright (C) 1993, Dale A. Harris (rodmur@ecst.csuchico.edu)
  362.   
  363. ***************
  364. *** 23,30 ****
  365.    Special Thanks to Emma Pease <emma@Russell.Stanford.EDU> for the man page!
  366.   
  367.    USAGE: getwxmap [ -DRdbsrmvkfu#x [xv options]  ]
  368. !    -D if you don't want the files displayed (implies -R)
  369. !    -R  if you don't want the files removed after displaying
  370.      -d for debugging (implies -f)
  371.      -s    Retrieves the current Surface Anaylsis Map (this usually gets
  372.              made a little before 15 minutes after the hour, so WXMAP
  373. --- 23,31 ----
  374.    Special Thanks to Emma Pease <emma@Russell.Stanford.EDU> for the man page!
  375.   
  376.    USAGE: getwxmap [ -DRdbsrmvkfu#x [xv options]  ]
  377. !    -D if you don't want the files displayed, files not removed unless -R is 
  378. !     used
  379. !    -R  files not removed after displaying, except with -x and -D
  380.      -d for debugging (implies -f)
  381.      -s    Retrieves the current Surface Anaylsis Map (this usually gets
  382.              made a little before 15 minutes after the hour, so WXMAP
  383. ***************
  384. *** 38,44 ****
  385.      -f    echo names of files successfully recieved to standard output
  386.      -x [xv options]  Pass ALL arguments that follow to XV as command line
  387.               options.  This option MUST come last.  Use this to get a
  388. !         background. (implies -R)
  389.   
  390.   */
  391.   
  392. --- 39,45 ----
  393.      -f    echo names of files successfully recieved to standard output
  394.      -x [xv options]  Pass ALL arguments that follow to XV as command line
  395.               options.  This option MUST come last.  Use this to get a
  396. !         background.  Files not removed unless -R is used.
  397.   
  398.   */
  399.   
  400. ***************
  401. *** 61,63 ****
  402. --- 62,65 ----
  403.   #define UMAPHOURMADE 3
  404.   #define UMAPMINMADE  5        /* minutes past the hour that the U*.GIF's made */
  405.   #define SMAPMINMADE 15        /* Minutes past the hour that SA*.GIF made */
  406. *** patchlevel.h.orig    Tue Mar 16 19:03:34 1993
  407. --- patchlevel.h    Tue Mar 16 19:04:08 1993
  408. ***************
  409. *** 0 ****
  410. --- 1 ----
  411. + #define PATCHLEVEL 2.3.2
  412.  
  413. -- 
  414.    __        _                     Dale A. Harris  {rodmur@ecst.csuchico.edu} 
  415.   /  )      //                           /"Get smart, rather than complicated."
  416.  /  / __.  // _      , , , __.  _       /_  _  __  _            J.L.
  417. /__/_(_/|_</_</_    (_(_/_(_/|_/_)_    / /_</_/ (_</_ 
  418.  
  419. exit 0 # Just in case...
  420.