MPTRAC
Functions
doy2day.c File Reference

Convert day of year to date. More...

#include "mptrac.h"

Go to the source code of this file.

Functions

void usage (void)
 Print command-line help. More...
 
int main (int argc, char *argv[])
 

Detailed Description

Convert day of year to date.

Definition in file doy2day.c.

Function Documentation

◆ usage()

void usage ( void  )

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 /* Print usage information... */
44 USAGE;
45
46 /* Check arguments... */
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 /* Read arguments... */
52 const int year = atoi(argv[1]);
53 const int doy = atoi(argv[2]);
54
55 /* Convert... */
56 int day, mon;
57 doy2day(year, doy, &mon, &day);
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).
Definition: mptrac.c:1605
#define ERRMSG(...)
Print an error message with contextual information and terminate the program.
Definition: mptrac.h:2102
#define USAGE
Print usage information on -h or --help.
Definition: mptrac.h:1909
Here is the call graph for this function: