home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / misc / volume35 / getwxmap / part01 < prev    next >
Encoding:
Text File  |  1993-03-03  |  18.4 KB  |  608 lines

  1. Newsgroups: comp.sources.misc
  2. From: rodmur@ecst.csuchico.edu (Dale Harris)
  3. Subject: v35i115:  getwxmap - Retrieve and display Weather satellite maps, Part01/01
  4. Message-ID: <1993Mar4.184751.3604@sparky.imd.sterling.com>
  5. X-Md4-Signature: f34160d08405c4f3ad44b1fc9f7a8acd
  6. Date: Thu, 4 Mar 1993 18:47:51 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: rodmur@ecst.csuchico.edu (Dale Harris)
  10. Posting-number: Volume 35, Issue 115
  11. Archive-name: getwxmap/part01
  12. Environment: X11, UNIX, xv
  13. Supersedes: getwxmap: Volume 34, Issue 120
  14.  
  15. Getwxmap retrieves the most recent satellite weather maps from vmd.cso.uiuc.edu
  16. and then displays them.  This is version 2.3.1.  The previous version was 
  17. written in ANSI C, but I had some problems with this new version when I 
  18. tried to keep it in ANSI C, so we are back to good old fashion C.  
  19.  
  20. Thanx to all with suggestions, I implementated everything I felt was 
  21. neccessary and I added a few things of my own, so a new version.  (Yes,
  22. Virginia, this gets the SA.GIF map, too).  Send suggestions/comments to 
  23. Dale A. Harris (rodmur@ecst.csuchico.edu).
  24. ----
  25. #! /bin/sh
  26. # This is a shell archive.  Remove anything before this line, then feed it
  27. # into a shell via "sh file" or similar.  To overwrite existing files,
  28. # type "sh file -c".
  29. # Contents:  getwxmap-2.3.1 getwxmap-2.3.1/Makefile
  30. #   getwxmap-2.3.1/README getwxmap-2.3.1/getwxmap.1
  31. #   getwxmap-2.3.1/getwxmap.c getwxmap-2.3.1/getwxmap.h
  32. # Wrapped by kent@sparky on Thu Mar  4 12:44:25 1993
  33. PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:/usr/lbin ; export PATH
  34. echo If this archive is complete, you will see the following message:
  35. echo '          "shar: End of archive 1 (of 1)."'
  36. if test ! -d 'getwxmap-2.3.1' ; then
  37.     echo shar: Creating directory \"'getwxmap-2.3.1'\"
  38.     mkdir 'getwxmap-2.3.1'
  39. fi
  40. if test -f 'getwxmap-2.3.1/Makefile' -a "${1}" != "-c" ; then 
  41.   echo shar: Will not clobber existing file \"'getwxmap-2.3.1/Makefile'\"
  42. else
  43.   echo shar: Extracting \"'getwxmap-2.3.1/Makefile'\" \(871 characters\)
  44.   sed "s/^X//" >'getwxmap-2.3.1/Makefile' <<'END_OF_FILE'
  45. X#
  46. X# Makefile for getwxmap.c ver 2.3.1
  47. X# Copyright (C) February 10, 1993 by Dale A. Harris
  48. X#                                {rodmur@ecst.csuchico.edu}
  49. X#
  50. X#CC=gcc
  51. XCC=cc
  52. X
  53. X#
  54. X# I know in a previous version I had this compiling in ANSI C
  55. X#  I ran into some problems doing that with gethostbyname()
  56. X#   that I couldn't explain, other than it was something the ANSI
  57. X#    flag was causing in the system header file, so we are back to 
  58. X#     good old fashioned C.
  59. X#
  60. X
  61. X#CFLAGS= -g  # for debugging 
  62. X#CFLAGS=-O #most machines in this world
  63. X#CFLAGS=-O2  #for gcc
  64. XCFLAGS= +O3 # with cc on HP9000/7xx-series running HPUX 8.*
  65. X
  66. X#Setting a domain is no longer neccessary
  67. XDEFINES= -DSYSV 
  68. X
  69. X#If you need any libs
  70. X#LIBS= -lmalloc #for HPUX if you like
  71. XLIBS= -lmalloc
  72. X
  73. Xgetwxmap: getwxmap.c
  74. X    $(CC) $(CFLAGS) -o getwxmap $(DEFINES) getwxmap.c $(LIBS)
  75. X
  76. Xclean:
  77. X    rm -f getwxmap.o getwxmap core *.GIF
  78. END_OF_FILE
  79.   if test 871 -ne `wc -c <'getwxmap-2.3.1/Makefile'`; then
  80.     echo shar: \"'getwxmap-2.3.1/Makefile'\" unpacked with wrong size!
  81.   fi
  82.   # end of 'getwxmap-2.3.1/Makefile'
  83. fi
  84. if test -f 'getwxmap-2.3.1/README' -a "${1}" != "-c" ; then 
  85.   echo shar: Will not clobber existing file \"'getwxmap-2.3.1/README'\"
  86. else
  87.   echo shar: Extracting \"'getwxmap-2.3.1/README'\" \(251 characters\)
  88.   sed "s/^X//" >'getwxmap-2.3.1/README' <<'END_OF_FILE'
  89. XCheck out the Makefile, if your on a SYSV machine you might want to
  90. X-DSYSV, check out the #define fields also in getwxmap.h
  91. X
  92. XIf you find any bugs or have any suggestions e-mail:
  93. Xrodmur@ecst.csuchico.edu
  94. X
  95. XThanx!
  96. X
  97. XDale Harris {rodmur@ecst.csuchico.edu}
  98. END_OF_FILE
  99.   if test 251 -ne `wc -c <'getwxmap-2.3.1/README'`; then
  100.     echo shar: \"'getwxmap-2.3.1/README'\" unpacked with wrong size!
  101.   fi
  102.   # end of 'getwxmap-2.3.1/README'
  103. fi
  104. if test -f 'getwxmap-2.3.1/getwxmap.1' -a "${1}" != "-c" ; then 
  105.   echo shar: Will not clobber existing file \"'getwxmap-2.3.1/getwxmap.1'\"
  106. else
  107.   echo shar: Extracting \"'getwxmap-2.3.1/getwxmap.1'\" \(1300 characters\)
  108.   sed "s/^X//" >'getwxmap-2.3.1/getwxmap.1' <<'END_OF_FILE'
  109. X.TH GETWXMAP 1 "30 November 1992"
  110. X.SH NAME
  111. Xgetwxmap \- retrieve weather maps and display on X11 displays
  112. X.SH SYNOPSIS
  113. X.B getwxmap
  114. X.RB [ " \-DRdfbsrvu#x [xv options]" ]
  115. X.SH DESCRIPTION
  116. X.B getwxmap
  117. Xretrieves the most recent of any of the various weather maps at
  118. Xvmd.cso.uiuc.edu and displays them using xv.  
  119. X.SH OPTIONS
  120. X.TP
  121. X.B \-D
  122. Xdon't display file (implies -R).
  123. X.TP
  124. X.B \-R
  125. Xdon't remove file when program finishes.
  126. X.TP
  127. X.B \-d
  128. Xdebugging (implies -f).
  129. X.TP
  130. X.B \-f
  131. Xecho name of files successfully retrieved to standard output
  132. X.TP
  133. X.B \-s
  134. Xretrieves the current Surface Anaylsis Map (this usually gets
  135. Xmade a little before 15 minutes after the hour, so WXMAP
  136. Xdoesn't grab it until 15 minutes or later after the hour).
  137. X.TP
  138. X.B \-r
  139. Xretrieves the most recent Infra Red Light Map.
  140. X.TP
  141. X.B \-m
  142. Xretrieves ALL the most recent MOS gifs.
  143. X.TP
  144. X.B \-v
  145. Xretrieves the most recent Visible Light Map.
  146. X.TP
  147. X.B \-u#
  148. Xretrieves the most recent Upper Air maps at a (# * 100hPa) intervals
  149. X(# = 2,3,5,7,8 for 200hPa, 300hPa, 500hPa, 700hPa, 800hPa respectively).
  150. X.TP
  151. X.B \-x [xv options]
  152. XMust be last argument.  All arguments following -x are passed
  153. Xas command line arguments to xv.  Use this to get a background. (Implies
  154. X-R)
  155. X.SH SEE ALSO
  156. X.BR xv (1V),
  157. X.SH AUTHOR
  158. XThis program is written by Dale A. Harris (rodmur@ecst.csuchico.edu).
  159. END_OF_FILE
  160.   if test 1300 -ne `wc -c <'getwxmap-2.3.1/getwxmap.1'`; then
  161.     echo shar: \"'getwxmap-2.3.1/getwxmap.1'\" unpacked with wrong size!
  162.   fi
  163.   # end of 'getwxmap-2.3.1/getwxmap.1'
  164. fi
  165. if test -f 'getwxmap-2.3.1/getwxmap.c' -a "${1}" != "-c" ; then 
  166.   echo shar: Will not clobber existing file \"'getwxmap-2.3.1/getwxmap.c'\"
  167. else
  168.   echo shar: Extracting \"'getwxmap-2.3.1/getwxmap.c'\" \(9018 characters\)
  169.   sed "s/^X//" >'getwxmap-2.3.1/getwxmap.c' <<'END_OF_FILE'
  170. X/*
  171. X   Copyright (C) 1993  Dale A. Harris, read getwxmap.h for additional
  172. X   information
  173. X*/
  174. X
  175. X/*
  176. XModified 1/27/93 C. Paul Ferroni (cpferron@cs.hh.ab.com):
  177. X1) added -x option to pass options to xv
  178. X2) added -f option to return ONLY file name(s)
  179. X3) modified (slightly) to compile with standard Sun "cc"
  180. X4) modified to get SA.GIF for surface map (instead of SAmmddhh.GIF)
  181. X      per changes made 2/3/93 to vmd.cso.uiuc.edu information.
  182. X
  183. XModified 2/10/93 d.a.h
  184. X1) Added gethostname and gethostbyname to automatically get domain name
  185. X2) Using access() to get file existance info so non-existant files won't go
  186. X    to xv
  187. X3) Moved header info to getwxmap.h
  188. X4) Rid of background (-b) option, -x makes it obsolete
  189. X
  190. X2/12/93 - added -m option for mos*.gif maps (d.a.h)
  191. X2/19/93 - added files variable - dah
  192. X
  193. X*/
  194. X
  195. X#include "getwxmap.h"
  196. X
  197. X
  198. Xmain (argc, argv)
  199. X     int argc;
  200. X     char **argv;
  201. X
  202. X{
  203. X  time_t seconds_off;
  204. X  int files = 0;
  205. X  struct tm *tp, *otp, *tptmp, *thetime ();
  206. X  char *mnthday, *gmt, *wgifs, *dispstr, *command, *filename, *uhour;
  207. X  char *tmp_char1, *tmp_char2;
  208. X  char *my_host, *xvargs;    /* hostname and xv arguments */
  209. X  register short surface = 0, visible = 0, infrared = 0, nodis = 0, norm = 0,
  210. X    debug = 0, upair = 0, keymap = 0, echoname = 0, mos = 0, i, j;
  211. X  short hpa[UMAPNO];
  212. X  struct hostent *my_site;    /* to get the site name */
  213. X  FILE *tosite;
  214. X  void usage ();
  215. X
  216. X  hpa[0] = 2;
  217. X  hpa[1] = 3;
  218. X  hpa[2] = 5;
  219. X  hpa[3] = 7;
  220. X  hpa[4] = 8;
  221. X
  222. X  mnthday = (char *) calloc (5, sizeof (char));
  223. X  gmt = (char *) calloc (7, sizeof (char));
  224. X  wgifs = (char *) calloc (400, sizeof (char));
  225. X  dispstr = (char *) calloc (150, sizeof (char));
  226. X  uhour = (char *) calloc (3, sizeof (char));
  227. X  command = (char *) calloc (30, sizeof (char));
  228. X  my_host = (char *) calloc (MAXHOSTNAMELEN + 1, sizeof (char));
  229. X  xvargs = (char *) calloc (200, sizeof (char));
  230. X
  231. X  if (argc == 1)
  232. X    {
  233. X      fprintf (stderr, "%s: Pick an option\n", argv[0]);
  234. X      usage ();
  235. X      exit (1);
  236. X    }
  237. X  for (i = 1; i < argc; ++i)
  238. X    for (j = (argv[i][0] == '-') ? 1 : 0; j < strlen (argv[i]); ++j)
  239. X      switch (argv[i][j])
  240. X    {
  241. X    case 's':
  242. X      ++surface;
  243. X      break;
  244. X    case 'r':
  245. X      ++infrared;
  246. X      break;
  247. X    case 'v':
  248. X      ++visible;
  249. X      break;
  250. X    case 'u':
  251. X      switch (argv[i][++j] & 15)
  252. X        {
  253. X        case 2:
  254. X          upair |= 1;
  255. X          break;
  256. X        case 3:
  257. X          upair |= 2;
  258. X          break;
  259. X        case 5:
  260. X          upair |= 4;
  261. X          break;
  262. X        case 7:
  263. X          upair |= 8;
  264. X          break;
  265. X        case 8:
  266. X          upair |= 16;
  267. X          break;
  268. X        default:
  269. X          fprintf (stderr, "%s: Unavailable map: %i\n", argv[0], argv[i][j] & 15);
  270. X          exit (1);
  271. X        }
  272. X      break;
  273. X    case 'D':
  274. X      ++nodis;
  275. X      break;
  276. X    case 'R':
  277. X      ++norm;
  278. X      break;
  279. X    case 'd':
  280. X      ++debug;
  281. X      break;
  282. X    case 'k':
  283. X      ++keymap;
  284. X      break;
  285. X    case 'm':
  286. X      ++mos;
  287. X      break;
  288. X    case 'f':
  289. X      ++echoname;
  290. X      break;
  291. X    case 'x':        /* grab the rest into xvargs and run... */
  292. X      while (i < argc - 1)
  293. X        {
  294. X          strcat (xvargs, argv[++i]);
  295. X          strcat (xvargs, " ");
  296. X        }
  297. X      j = strlen (argv[i]);    /* to break from j loop */
  298. X      ++norm;
  299. X      break;
  300. X    default:
  301. X      fprintf (stderr, "%s: Bad Option: %c\n", argv[0], argv[i][j]);
  302. X      usage ();
  303. X      exit (1);
  304. X    }
  305. X  if (strlen (xvargs) == 0)
  306. X    strcat (xvargs, " ");    /* empty string */
  307. X
  308. X  /* getting the time */
  309. X  otp = tp = thetime ((time_t) 0, tp, argv[0]);
  310. X  strftime (gmt, SMAX, "%m%d%H", tp);
  311. X
  312. X  if (surface)
  313. X    strcat (wgifs, " SA.GIF ");
  314. X  tmp_char1 = (char *) strdup (wgifs);
  315. X  if (tp->tm_min >= SMAPMINMADE)
  316. X    sprintf (wgifs, "%s SA%s.GIF ", tmp_char1, gmt);
  317. X  else
  318. X    {
  319. X      fprintf (stderr, "%s: SA%s.GIF not made until %d past the hour, getting last hours map.\n", argv[0], gmt, SMAPMINMADE);
  320. X      /* Take off an hour's worth of seconds if before the quarter hour */
  321. X      tp = thetime ((time_t) 3600, tp, argv[0]);
  322. X      strftime (gmt, SMAX, "%m%d%H", tp);
  323. X      sprintf (wgifs, "%s SA%s.GIF ", tmp_char1, gmt);
  324. X      tptmp = tp;
  325. X      tp = otp;
  326. X      free (tptmp);
  327. X    }
  328. X  free (tmp_char1);
  329. X  if (infrared)
  330. X    strcat (wgifs, " CIR.GIF ");
  331. X  if (visible)
  332. X    strcat (wgifs, " CVIS.GIF ");
  333. X  if (mos)
  334. X    strcat (wgifs, " MOS06.GIF MOS09.GIF MOS12.GIF MOS15.GIF MOS18.GIF MOS21.GIF MOS24.GIF MOS27.GIF MOS30.GIF MOS33.GIF MOS36.GIF MOS39.GIF MOS42.GIF MOS45.GIF MOS48.GIF MOS51.GIF MOS54.GIF MOS57.GIF MOS60.GIF ");
  335. X  if (upair)
  336. X    /*
  337. XThe GMT hours of 3 to 15 was my best guess when the upperair maps
  338. Xget made, but on occasion it appears to be differant, so all I can
  339. Xsay is best of luck!
  340. X*/
  341. X    {
  342. X      if (tp->tm_hour < UMAPHOURMADE)
  343. X    {
  344. X      /* if at 0 to 2 GMT take off the (hour + 1) times an hours worth of seconds */
  345. X      seconds_off = (tp->tm_hour + 1) * 3600;
  346. X      tp = thetime (seconds_off, tp, argv[0]);
  347. X      strftime (mnthday, SMAX, "%m%d", tp);
  348. X      tptmp = tp;
  349. X      tp = otp;
  350. X      free (tptmp);
  351. X    }
  352. X      else
  353. X    strftime (mnthday, SMAX, "%m%d", tp);
  354. X
  355. X      for (i = 0; i <= (UMAPNO - 1); ++i)
  356. X    {
  357. X      if (upair & 1)
  358. X        {
  359. X
  360. X          /* attach proper hour onto the end of u*.gifs */
  361. X          strcpy (uhour, ((tp->tm_hour >= UMAPHOURMADE)
  362. X             && (tp->tm_hour < (UMAPHOURMADE + 12))) ? "00" : "12");
  363. X
  364. X          /* if it is the hours that the u*.gifs are made and if not 5 past the
  365. X      hour, then don't get them */
  366. X
  367. X          if (((tp->tm_hour == UMAPHOURMADE)
  368. X           || (tp->tm_hour == (UMAPHOURMADE + 12)))
  369. X          && (tp->tm_min < UMAPMINMADE))
  370. X        fprintf (stderr, "%s: wait until %d after the hour for U%d%s%s.GIF\n", argv[0], UMAPMINMADE, hpa[i], mnthday, uhour);
  371. X          else
  372. X        {
  373. X          tmp_char1 = (char *) strdup (wgifs);
  374. X          sprintf (wgifs, " %s U%d%s%s.GIF ", tmp_char1, hpa[i], mnthday, uhour);
  375. X          free (tmp_char1);
  376. X        }
  377. X        }
  378. X      upair >>= 1;
  379. X    }
  380. X    }
  381. X  if (keymap)
  382. X    {
  383. X      strcat (wgifs, " WXKEY.GIF ");
  384. X    }
  385. X
  386. X  /* getting site info */
  387. X  if (gethostname (my_host, (size_t) MAXHOSTNAMELEN + 1) == -1)
  388. X    {
  389. X      perror (argv[0]);
  390. X      exit (1);
  391. X    }
  392. X
  393. X  if ((my_site = gethostbyname (my_host)) == (struct hostent *) NULL)
  394. X    {
  395. X      perror (argv[0]);
  396. X      exit (1);
  397. X    }
  398. X
  399. X  /* Using ftp to grab the files */
  400. X
  401. X  if (strlen (wgifs) != 0)
  402. X    {
  403. X      if (debug)
  404. X    sprintf (command, "ftp -i -n -v %s", SITE);
  405. X      else
  406. X    sprintf (command, "ftp -i -n %s", SITE);
  407. X
  408. X      if ((tosite = (FILE *) popen (command, "w")) == (FILE *) NULL)
  409. X    {
  410. X      perror (argv[0]);
  411. X      exit (1);
  412. X    }
  413. X      fprintf (tosite, "user anonymous %s@%s\n", getlogin (), my_site->h_name);
  414. X      fputs ("bin\n", tosite);
  415. X      if (debug)
  416. X    fputs ("hash\n", tosite);
  417. X      fprintf (tosite, "cd %s\n", DIR);
  418. X      fprintf (tosite, "mget %s\n", wgifs);
  419. X      fputs ("quit\n", tosite);
  420. X      pclose (tosite);
  421. X
  422. X      tmp_char1 = (char *) strdup (wgifs);
  423. X      free (wgifs);
  424. X      wgifs = (char *) calloc (400, sizeof (char));
  425. X      filename = strtok (tmp_char1, " ");
  426. X      while (filename != (char *) NULL)
  427. X    {
  428. X      if (access (filename, F_OK) == -1)
  429. X        /* check to see if file exists */
  430. X        fprintf (stderr, "%s: %s doesn't exist\n", argv[0], filename);
  431. X      else
  432. X        {
  433. X          tmp_char2 = (char *) strdup (wgifs);
  434. X          sprintf (wgifs, "%s %s ", tmp_char2, filename);
  435. X          free (tmp_char2);
  436. X          files++;
  437. X          if (echoname || debug)
  438. X        puts (filename);
  439. X        }
  440. X      filename = strtok ((char *) NULL, " ");
  441. X    }
  442. X      free (tmp_char1);
  443. X
  444. X      if (!files)
  445. X    {
  446. X      fprintf (stderr, "%s: No files received.  Bummer!\n", argv[0]);
  447. X      exit (1);
  448. X    }
  449. X      if (!nodis)
  450. X    {
  451. X      sprintf (dispstr, "%s %s %s", DISP, xvargs, wgifs);
  452. X      system (dispstr);
  453. X    }
  454. X
  455. X      if (!norm && !nodis)
  456. X    {
  457. X      filename = strtok (wgifs, " ");
  458. X      while (filename != (char *) NULL)
  459. X        {
  460. X          /* no use checking what unlink returns because I don't care */
  461. X          unlink (filename);
  462. X          filename = strtok ((char *) NULL, " ");
  463. X        }
  464. X    }
  465. X    }
  466. X  exit (0);
  467. X}
  468. X
  469. Xstruct tm *
  470. Xthetime (s_off, tp, name)
  471. X     time_t s_off;
  472. X     struct tm *tp;
  473. X     char *name;
  474. X
  475. X{
  476. X  time_t datime;
  477. X
  478. X  if ((datime = time ((time_t *) NULL)) == (time_t) - 1)
  479. X    {
  480. X      perror (name);
  481. X      exit (1);
  482. X    }
  483. X  datime -= s_off;
  484. X  if ((tp = gmtime (&datime)) == (struct tm *) NULL)
  485. X    {
  486. X      perror (name);
  487. X      exit (1);
  488. X    }
  489. X  return (tp);
  490. X}
  491. X
  492. Xvoid
  493. Xusage ()
  494. X{
  495. X  fputs ("Usage: getwxmap [ -RDdfsrmvku#x [xv options] ]\n", stderr);
  496. X  fputs ("-D if you don't want the files displayed (implies -R)\n", stderr);
  497. X  fputs ("-R if you don't want the files removed after displaying\n", stderr);
  498. X  fputs ("-d for debugging (implies -f)\n", stderr);
  499. X  fputs ("-f echos names of successfully retrieved files to standard out\n", stderr);
  500. X  fputs ("-s For the Surface Anaylsis map\n", stderr);
  501. X  fputs ("-r for the Infra Red Light Map\n", stderr);
  502. X  fputs ("-m for ALL the MOS gifs\n", stderr);
  503. X  fputs ("-v for Visible Light Map\n", stderr);
  504. X  fputs ("-k for the WX key map (note: this picture doesn't change)\n", stderr);
  505. X  fputs ("-u# for the Upper Air maps at a # * 100 hPa itervals\n", stderr);
  506. X  fputs ("(# = 2,3,5,7,8 for 200hPa, 300hPa, 500hPa, 700hPa, 800hPa respectively)\n", stderr);
  507. X  fputs ("-x [xv options]  Pass ALL arguments that follow to XV as command line\n", stderr);
  508. X  fputs ("options.  This option MUST come last.  Use this to get a background. (implies -R)\n", stderr);
  509. X  return;
  510. X}
  511. END_OF_FILE
  512.   if test 9018 -ne `wc -c <'getwxmap-2.3.1/getwxmap.c'`; then
  513.     echo shar: \"'getwxmap-2.3.1/getwxmap.c'\" unpacked with wrong size!
  514.   fi
  515.   # end of 'getwxmap-2.3.1/getwxmap.c'
  516. fi
  517. if test -f 'getwxmap-2.3.1/getwxmap.h' -a "${1}" != "-c" ; then 
  518.   echo shar: Will not clobber existing file \"'getwxmap-2.3.1/getwxmap.h'\"
  519. else
  520.   echo shar: Extracting \"'getwxmap-2.3.1/getwxmap.h'\" \(2446 characters\)
  521.   sed "s/^X//" >'getwxmap-2.3.1/getwxmap.h' <<'END_OF_FILE'
  522. X/*
  523. X @(#) getwxmap 2.3.1, February 19, 1993
  524. X
  525. X Copyright (C) 1993, Dale A. Harris (rodmur@ecst.csuchico.edu)
  526. X
  527. X This program may be freely re-distributed at no charge provided that
  528. X that all headers are left intact.  Modified copies must preserve this notice.
  529. X It is requested that any useful changes you make be sent to the author.
  530. X
  531. X GETWXMAP:
  532. X Is a C program that was converted from a shell script I wrote to retrieve the
  533. X most recent of any  the various weather maps at vmd.cso.uiuc.edu and display
  534. X them using  some utility similar to xv (xv is a multi-purpose GIF, JPEG,
  535. X etc.,  displayer for X-windows, written by John Bradley
  536. X (bradley@cis.upenn.edu))
  537. X
  538. X Much thanks to Charlie Kline (cvk@uiuc.edu), and all the others I may
  539. X  not know about, for their work on publicly available satellite weather
  540. X  images
  541. X
  542. X Thanks a bunch to all with bug reports and fixes.
  543. X
  544. X Special Thanks to Emma Pease <emma@Russell.Stanford.EDU> for the man page!
  545. X
  546. X USAGE: getwxmap [ -DRdbsrmvkfu#x [xv options]  ]
  547. X   -D if you don't want the files displayed (implies -R)
  548. X   -R  if you don't want the files removed after displaying
  549. X   -d for debugging (implies -f)
  550. X   -s    Retrieves the current Surface Anaylsis Map (this usually gets
  551. X           made a little before 15 minutes after the hour, so WXMAP
  552. X           doesn't grab it until 15 minutes or later after the hour)
  553. X   -r    Retrieves the most recent Infra Red Light Map
  554. X   -m    Retrieves ALL of the most recent MOS gifs
  555. X   -v    Retrieves the most recent Visible Light Map
  556. X   -k    Retrieves the most WX keymap (note: this picture doesn't change)
  557. X   -u#  Retrieves the most recent Upper Air maps at a # * 100hPa itervals
  558. X   (# = 2,3,5,7,8 for 200hPa, 300hPa, 500hPa, 700hPa, 800hPa respectively)
  559. X   -f    echo names of files successfully recieved to standard output
  560. X   -x [xv options]  Pass ALL arguments that follow to XV as command line
  561. X            options.  This option MUST come last.  Use this to get a
  562. X        background. (implies -R)
  563. X
  564. X*/
  565. X
  566. X#include <stdio.h>
  567. X#include <time.h>
  568. X#include <stdlib.h>
  569. X#ifdef SYSV
  570. X#include <malloc.h>
  571. X#endif
  572. X#include <string.h>
  573. X#include <unistd.h>
  574. X#include <sys/param.h>
  575. X#include <netdb.h>
  576. X
  577. X#define SMAX 7
  578. X#define SITE "vmd.cso.uiuc.edu"
  579. X#define DIR "wx"
  580. X#define DISP "xv"
  581. X#define UMAPNO 5        /* number of umaps */
  582. X#define UMAPHOURMADE 3
  583. X#define UMAPMINMADE  5        /* minutes past the hour that the U*.GIF's made */
  584. X#define SMAPMINMADE 15        /* Minutes past the hour that SA*.GIF made */
  585. END_OF_FILE
  586.   if test 2446 -ne `wc -c <'getwxmap-2.3.1/getwxmap.h'`; then
  587.     echo shar: \"'getwxmap-2.3.1/getwxmap.h'\" unpacked with wrong size!
  588.   fi
  589.   # end of 'getwxmap-2.3.1/getwxmap.h'
  590. fi
  591. echo shar: End of archive 1 \(of 1\).
  592. cp /dev/null ark1isdone
  593. MISSING=""
  594. for I in 1 ; do
  595.     if test ! -f ark${I}isdone ; then
  596.     MISSING="${MISSING} ${I}"
  597.     fi
  598. done
  599. if test "${MISSING}" = "" ; then
  600.     echo You have the archive.
  601.     rm -f ark[1-9]isdone
  602. else
  603.     echo You still must unpack the following archives:
  604.     echo "        " ${MISSING}
  605. fi
  606. exit 0
  607. exit 0 # Just in case...
  608.