Fix psoition reporting for calendar data file in system directory

MFC after:	3 days
This commit is contained in:
Stefan Eßer 2020-11-01 20:38:35 +00:00
parent a97cfe08a7
commit ab34af0746
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=367255

View File

@ -147,10 +147,22 @@ cal_fopen(const char *file)
return (NULL);
}
static char*
cal_path(void)
{
static char buffer[MAXPATHLEN + 10];
if (cal_dir[0] == '/')
snprintf(buffer, sizeof(buffer), "%s/%s", cal_dir, cal_file);
else
snprintf(buffer, sizeof(buffer), "%s/%s/%s", cal_home, cal_dir, cal_file);
return (buffer);
}
#define WARN0(format) \
warnx(format " in %s/%s/%s line %d", cal_home, cal_dir, cal_file, cal_line)
warnx(format " in %s line %d", cal_path(), cal_line)
#define WARN1(format, arg1) \
warnx(format " in %s/%s/%s line %d", arg1, cal_home, cal_dir, cal_file, cal_line)
warnx(format " in %s line %d", arg1, cal_path(), cal_line)
static int
token(char *line, FILE *out, int *skip, int *unskip)