Provide an array of available date input formats
This will allow to fix the current hardcoding of strings describing date input formats in multiple places. Signed-off-by: Baptiste Jonglez <baptiste--git@jonglez.org> Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
This commit is contained in:
parent
9e1185f526
commit
9adacec623
@ -940,6 +940,7 @@ extern unsigned colorize;
|
|||||||
extern int foreground, background;
|
extern int foreground, background;
|
||||||
extern enum ui_mode ui_mode;
|
extern enum ui_mode ui_mode;
|
||||||
extern int read_only;
|
extern int read_only;
|
||||||
|
extern const char *datefmt_str[DATE_FORMATS];
|
||||||
extern int days[12];
|
extern int days[12];
|
||||||
extern const char *monthnames[12];
|
extern const char *monthnames[12];
|
||||||
extern const char *daynames[8];
|
extern const char *daynames[8];
|
||||||
|
@ -61,6 +61,9 @@ enum ui_mode ui_mode = UI_CMDLINE;
|
|||||||
/* Don't save anything if this is set. */
|
/* Don't save anything if this is set. */
|
||||||
int read_only = 0;
|
int read_only = 0;
|
||||||
|
|
||||||
|
/* Strings describing each input date format. */
|
||||||
|
const char *datefmt_str[DATE_FORMATS];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* variables to store calendar names
|
* variables to store calendar names
|
||||||
*/
|
*/
|
||||||
@ -136,6 +139,11 @@ void vars_init(void)
|
|||||||
strncpy(conf.output_datefmt, "%D", 3);
|
strncpy(conf.output_datefmt, "%D", 3);
|
||||||
conf.input_datefmt = 1;
|
conf.input_datefmt = 1;
|
||||||
|
|
||||||
|
datefmt_str[0] = _("mm/dd/yyyy");
|
||||||
|
datefmt_str[1] = _("dd/mm/yyyy");
|
||||||
|
datefmt_str[2] = _("yyyy/mm/dd");
|
||||||
|
datefmt_str[3] = _("yyyy-mm-dd");
|
||||||
|
|
||||||
/* Default external editor and pager */
|
/* Default external editor and pager */
|
||||||
ed = getenv("VISUAL");
|
ed = getenv("VISUAL");
|
||||||
if (ed == NULL || ed[0] == '\0')
|
if (ed == NULL || ed[0] == '\0')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user