Turn a bunch of Eprint calls into Wprint calls to indicate warnings instead of errors.

This commit is contained in:
Dianne Skoll
2022-03-12 10:27:58 -05:00
parent 5aaf19ffdb
commit 61d665ef7d
7 changed files with 38 additions and 19 deletions

View File

@@ -424,7 +424,7 @@ int ParseRem(ParsePtr s, Trigger *trig, TimeTrig *tim, int save_in_globals)
case T_Omit:
DBufFree(&buf);
if (trig->omitfunc[0]) {
Eprint("Warning: OMIT is ignored if you use OMITFUNC");
Wprint("Warning: OMIT is ignored if you use OMITFUNC");
}
r = ParseLocalOmit(s, trig);
@@ -438,7 +438,7 @@ int ParseRem(ParsePtr s, Trigger *trig, TimeTrig *tim, int save_in_globals)
case T_OmitFunc:
if (trig->localomit) {
Eprint("Warning: OMIT is ignored if you use OMITFUNC");
Wprint("Warning: OMIT is ignored if you use OMITFUNC");
}
r=ParseToken(s, &buf);
if (r) return r;
@@ -534,22 +534,22 @@ int ParseRem(ParsePtr s, Trigger *trig, TimeTrig *tim, int save_in_globals)
if (!s->nonconst_expr) {
if (trig->y != NO_YR && trig->m != NO_MON && trig->d != NO_DAY && trig->until != NO_UNTIL) {
if (Julian(trig->y, trig->m, trig->d) > trig->until) {
Eprint("Warning: UNTIL/THROUGH date earlier than start date");
Wprint("Warning: UNTIL/THROUGH date earlier than start date");
}
}
if (trig->from != NO_DATE) {
if (trig->until != NO_UNTIL && trig->until < trig->from) {
Eprint("Warning: UNTIL/THROUGH date earlier than FROM date");
Wprint("Warning: UNTIL/THROUGH date earlier than FROM date");
}
} else if (trig->scanfrom != NO_DATE) {
if (trig->until != NO_UNTIL && trig->until < trig->scanfrom) {
Eprint("Warning: UNTIL/THROUGH date earlier than SCANFROM date");
Wprint("Warning: UNTIL/THROUGH date earlier than SCANFROM date");
}
}
}
if (trig->y != NO_YR && trig->m != NO_MON && trig->d != NO_DAY && trig->until != NO_UNTIL && trig->rep == NO_REP) {
Eprint("Warning: Useless use of UNTIL with fully-specified date and no *rep");
Wprint("Warning: Useless use of UNTIL with fully-specified date and no *rep");
}
/* Set scanfrom to default if not set explicitly */

View File

@@ -2414,8 +2414,7 @@ static int FPsshade(func_info *info)
if (!psshade_warned) {
psshade_warned = 1;
Eprint("psshade() is deprecated; use SPECIAL SHADE instead.");
FreshLine = 1;
Wprint("psshade() is deprecated; use SPECIAL SHADE instead.");
}
sprintf(s, "/_A LineWidth 2 div def ");
@@ -2470,8 +2469,7 @@ static int FPsmoon(func_info *info)
}
if (!psmoon_warned) {
psmoon_warned = 1;
Eprint("psmoon() is deprecated; use SPECIAL MOON instead.");
FreshLine = 1;
Wprint("psmoon() is deprecated; use SPECIAL MOON instead.");
}
if (size > 0) {
sprintf(sizebuf, "%d", size);
@@ -2988,7 +2986,7 @@ FEvalTrig(func_info *info)
} else {
/* Hokey... */
if (trig.scanfrom != JulianToday) {
Eprint("Warning: SCANFROM is ignored in two-argument form of evaltrig()");
Wprint("Warning: SCANFROM is ignored in two-argument form of evaltrig()");
}
jul = ComputeTrigger(scanfrom, &trig, &tim, &r, 0);
}

View File

@@ -568,6 +568,29 @@ int EvaluateExpr(ParsePtr p, Value *v)
return OK;
}
/***************************************************************/
/* */
/* Wprint - print a warning message. */
/* */
/***************************************************************/
void Wprint(char const *fmt, ...)
{
va_list argptr;
if (FileName) {
if (strcmp(FileName, "-"))
(void) fprintf(ErrFp, "%s(%d): ", FileName, LineNo);
else
(void) fprintf(ErrFp, "-stdin-(%d): ", LineNo);
}
va_start(argptr, fmt);
(void) vfprintf(ErrFp, fmt, argptr);
(void) fputc('\n', ErrFp);
va_end(argptr);
return;
}
/***************************************************************/
/* */
/* Eprint - print an error message. */

View File

@@ -463,7 +463,7 @@ DoThroughOmit(ParsePtr p, int ystart, int mstart, int dstart)
end = Julian(yend, mend, dend);
if (end < start) {
Eprint("Warning: Swapping dates on OMIT ... THROUGH ... line");
Wprint("Warning: Swapping dates on OMIT ... THROUGH ... line");
tmp = start;
start = end;
end = tmp;

View File

@@ -62,6 +62,7 @@ int EvaluateExpr (ParsePtr p, Value *v);
int Evaluate (char const **s, Var *locals, ParsePtr p);
int FnPopValStack (Value *val);
void Eprint (char const *fmt, ...);
void Wprint (char const *fmt, ...);
void OutputLine (FILE *fp);
void CreateParser (char const *s, ParsePtr p);
void DestroyParser (ParsePtr p);

View File

@@ -167,7 +167,7 @@ int DoFset(ParsePtr p)
/* Add the function definition */
FSet(func);
if (orig_namelen > VAR_NAME_LEN) {
Eprint("Warning: Function name `%s...' truncated to `%s'",
Wprint("Warning: Function name `%s...' truncated to `%s'",
func->name, func->name);
}
return OK;

View File

@@ -43,8 +43,7 @@ typedef int (*SysVarFunc)(int, Value *);
static void deprecated_var(char const *var, char const *instead)
{
if (DebugFlag & DB_PRTLINE) {
Eprint("%s is deprecated; use %s instead", var, instead);
FreshLine = 1;
Wprint("%s is deprecated; use %s instead", var, instead);
}
}
@@ -508,7 +507,7 @@ int DoSet (Parser *p)
if (*DBufValue(&buf) == '$') r = SetSysVar(DBufValue(&buf)+1, &v);
else r = SetVar(DBufValue(&buf), &v);
if (buf.len > VAR_NAME_LEN) {
Eprint("Warning: Variable name `%.*s...' truncated to `%.*s'",
Wprint("Warning: Variable name `%.*s...' truncated to `%.*s'",
VAR_NAME_LEN, DBufValue(&buf), VAR_NAME_LEN, DBufValue(&buf));
}
DBufFree(&buf);
@@ -908,9 +907,7 @@ int GetSysVar(char const *name, Value *val)
/* In "verbose" mode, print attempts to test $RunOff */
if (DebugFlag & DB_PRTLINE) {
if (v->value == (void *) &RunDisabled) {
Eprint("(Security note: $RunOff variable tested.)");
/* Allow further messages from this line */
FreshLine = 1;
Wprint("(Security note: $RunOff variable tested.)");
}
}
return OK;