int
cmd_value_labels (void)
{
- lex_match_id ("VALUE");
- lex_match_id ("LABELS");
return do_value_labels (1);
}
int
cmd_add_value_labels (void)
{
- lex_match_id ("ADD");
- lex_match_id ("VALUE");
- lex_match_id ("LABELS");
return do_value_labels (0);
}
\f
{
struct variable **vars; /* Variable list. */
int var_cnt; /* Number of variables. */
+ int parse_err=0; /* true if error parsing variables */
lex_match ('/');
while (token != '.')
{
- parse_variables (default_dict, &vars, &var_cnt, PV_SAME_TYPE);
+ parse_err = !parse_variables (default_dict, &vars, &var_cnt,
+ PV_SAME_TYPE) ;
+ if (var_cnt < 1)
+ {
+ free(vars);
+ return CMD_FAILURE;
+ }
if (!verify_val_labs (vars, var_cnt))
goto lossage;
if (erase)
free (vars);
}
+ free (vars);
if (token != '.')
{
return CMD_TRAILING_GARBAGE;
}
- return CMD_SUCCESS;
+ return parse_err ? CMD_PART_SUCCESS_MAYBE : CMD_SUCCESS;
lossage:
free (vars);
lex_error (_("expecting string"));
return 0;
}
- st_bare_pad_copy (value.s, ds_value (&tokstr), MAX_SHORT_STRING);
+ st_bare_pad_copy (value.s, ds_c_str (&tokstr), MAX_SHORT_STRING);
}
else
{
msg (SW, _("Truncating value label to 60 characters."));
ds_truncate (&tokstr, 60);
}
- label = ds_value (&tokstr);
+ label = ds_c_str (&tokstr);
for (i = 0; i < var_cnt; i++)
val_labs_replace (vars[i]->val_labs, value, label);