X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=src%2Flanguage%2Fdictionary%2Fsplit-file.c;h=8a134e1e769eca5562e57e31febb49b9c29b03d0;hb=209f7e5ccf28c97641b9e69ef6b9df81efe4dc38;hp=1ebd7ae9ca6fa415cd2b13a737ea255827562244;hpb=339f1956cc727eda788638644ef93ab7852b31cd;p=pspp diff --git a/src/language/dictionary/split-file.c b/src/language/dictionary/split-file.c index 1ebd7ae9ca..8a134e1e76 100644 --- a/src/language/dictionary/split-file.c +++ b/src/language/dictionary/split-file.c @@ -43,20 +43,30 @@ int cmd_split_file (struct lexer *lexer, struct dataset *ds) { if (lex_match_id (lexer, "OFF")) - dict_set_split_vars (dataset_dict (ds), NULL, 0); + dict_clear_split_vars (dataset_dict (ds)); else { struct variable **v; size_t n; - /* For now, ignore SEPARATE and LAYERED. */ - (void) (lex_match_id (lexer, "SEPARATE") || lex_match_id (lexer, "LAYERED")); + enum split_type type = (!lex_match_id (lexer, "LAYERED") + && lex_match_id (lexer, "SEPARATE") + ? SPLIT_SEPARATE + : SPLIT_LAYERED); lex_match (lexer, T_BY); if (!parse_variables (lexer, dataset_dict (ds), &v, &n, PV_NO_DUPLICATE)) return CMD_CASCADING_FAILURE; - dict_set_split_vars (dataset_dict (ds), v, n); + if (n > MAX_SPLITS) + { + verify (MAX_SPLITS == 8); + msg (SE, _("At most 8 split variables may be specified.")); + free (v); + return CMD_CASCADING_FAILURE; + } + + dict_set_split_vars (dataset_dict (ds), v, n, type); free (v); }