This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.
Tom-
I'm working on a Java interface to the weather text server
(wtxgserv.cp) and found that it core dumps if I don't pass
along the certain keyword. According to the Programmer's reference,
the default for the day is the current day, but in wtxgserv,
it assumes that the day has been initialized by calling
atoi on key_parm_list[DAY_KWD][0]:
/* we now need to convert a few of the keyword return values to ints
*/
search_start_day = atoi (key_parm_list[DAY_KWD][0]);
search_end_day = search_start_day;
if (n_parms[DAY_KWD] > 1)
{
search_end_day = atoi (key_parm_list[DAY_KWD][0]);
search_start_day = atoi (key_parm_list[DAY_KWD][1]);
start_time = current_time;
end_time = start_time;
}
k_dtime = atof (key_parm_list[DTIME_KWD][0]);
k_num = atoi (key_parm_list[NUM_KWD][0]);
k_num = (k_num < 1) ? 1 : k_num;
Maybe
search_start_day = atoi (key_parm_list[DAY_KWD][0]);
should be:
search_start_day = (n_parms[DAY_KWD] == 0)
? current_day : atoi (key_parm_list[DAY_KWD][0]);
The same problem occurs with NUM= keyword, (which is supposed
to default to 1) and DTIME (which has no default, but the
atof call would fail) and might be fixed with the same
sort of check.
Could you look into this?
Thanks.
Don
*************************************************************
Don Murray UCAR Unidata Program
address@hidden P.O. Box 3000
(303) 497-8628 Boulder, CO 80307
http://www.unidata.ucar.edu/staff/donm
*************************************************************