Mapper
shtdat.c
Go to the documentation of this file.
1 
2 #define _POSIX_SOURCE
3 #include <stdio.h>
4 #include <stdlib.h>
5 #include <ctype.h>
6 #include <dirent.h>
7 #include <unistd.h>
8 #include <math.h>
9 #include <string.h>
10 #include <fcntl.h>
11 #include <sys/stat.h>
12 #include "shef_structs_external.h"
13 
14 /*---------------------------------------------------------------------
15 
16  NAME
17  SUBROUTINE SHTDAT(LYEAR,LMON,LDAY,STATUS)
18 
19  PURPOSE
20  THIS ROUTINE CHECKS TO SEE IF A DATE IS VALID.
21 
22  VERSION and UPDATES
23  1.0 AUG 82 Geoffrey M. Bonnin
24  Original Version
25  2.0 MAY 94 David G. Brandon
26  Also Translated to 'C' using FOR_C
27 
28  --------------------------------------------------------------------- */
29 
30 void shtdat(lyear, lmon, lday, status)
31 short int *lyear, *lmon, *lday, *status;
32 {
33  static short int leap, mon;
34  void shleap();
35  *status = 0;
36 
37  /* Test the month */
38 
39  if( (*lmon > 12) || (*lmon < 1) )
40  goto L_9000;
41 
42  /* Test the day */
43 
44  mon = *lmon;
45  if( *lday < 1 )
46  goto L_9000;
47  if( mon == 2 )
48  goto L_10;
49  if( mon >= 8 )
50  mon = mon + 1;
51  leap = 30 + mon - (mon/2)*2;
52  if( *lday > leap )
53  goto L_9000;
54  goto L_100;
55 
56 L_10:
57  shleap( lyear, &leap );
58  if( *lday > (leap + 28) )
59  goto L_9000;
60 
61 L_100:
62  return;
63 
64 L_9000:
65  *status = 1;
66  return;
67 
68 }
69 
char * mon[]
void shleap(short int *lyear, short int *leap)
Definition: shleap.c:42
void * leap
Definition: shleap.cc:39
void shtdat(short int *lyear, short int *lmon, short int *lday, short int *status)
Definition: shtdat.c:30