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