Convert day of year to date.
More...
Go to the source code of this file.
|
| void | usage (void) |
| | Print command-line help. More...
|
| |
| int | main (int argc, char *argv[]) |
| |
Convert day of year to date.
Definition in file doy2day.c.
◆ usage()
Print command-line help.
Definition at line 66 of file doy2day.c.
67 {
68
69 printf("\nMPTRAC doy2day tool.\n\n");
70 printf("Convert year and day of year to calendar date.\n");
71 printf("\n");
72 printf("Usage:\n");
73 printf(" doy2day <year> <doy>\n");
74 printf("\n");
75 printf("Arguments:\n");
76 printf(" <year> Year.\n");
77 printf(" <doy> Day of year.\n");
78 printf("\nFurther information:\n");
79 printf(" Manual: https://slcs-jsc.github.io/mptrac/\n");
80}
◆ main()
| int main |
( |
int |
argc, |
|
|
char * |
argv[] |
|
) |
| |
Definition at line 39 of file doy2day.c.
41 {
42
43
45
46
47 if (argc < 3)
48 ERRMSG(
"Missing or invalid command-line arguments.\n\n"
49 "Usage: doy2day <year> <doy>\n\n" "Use -h for full help.");
50
51
52 const int year = atoi(argv[1]);
53 const int doy = atoi(argv[2]);
54
55
56 int day, mon;
58 printf("%d %d %d\n", year, mon, day);
59
60 return EXIT_SUCCESS;
61}
void doy2day(const int year, const int doy, int *mon, int *day)
Converts a given day of the year (DOY) to a date (month and day).
#define ERRMSG(...)
Print an error message with contextual information and terminate the program.
#define USAGE
Print usage information on -h or --help.