- if (lex_match (T_BY))
- {
- if (seen & 1)
- {
- msg (SE, _("The BY subcommand may be given once at most."));
- goto lossage;
- }
- seen |= 1;
-
- lex_match ('=');
- if (!parse_variables (mtf_master, &mtf_by, &mtf_n_by,
- PV_NO_DUPLICATE | PV_NO_SCRATCH))
- goto lossage;
- }
- else if (token != T_ID)
- {
- lex_error (NULL);
- goto lossage;
- }
- else if (lex_id_match ("FILE", tokid) || lex_id_match ("TABLE", tokid))
- {
- struct mtf_file *file = xmalloc (sizeof *file);
-
- file->in[0] = file->first[0] = file->last[0] = '\0';
- file->dict = NULL;
- file->by = NULL;
- file->input = NULL;
-
- if (lex_match_id ("FILE"))
- file->type = MTF_FILE;
- else if (lex_match_id ("TABLE"))
- {
- file->type = MTF_TABLE;
- seen |= 4;
- }
- else
- assert (0);
-
- /* FILEs go first, then TABLEs. */
- if (file->type == MTF_TABLE || first_table == NULL)
- {
- file->next = NULL;
- file->prev = mtf_tail;
- if (mtf_tail)
- mtf_tail->next = file;
- mtf_tail = file;
- if (mtf_head == NULL)
- mtf_head = file;
- if (file->type == MTF_TABLE && first_table == NULL)
- first_table = file;
- }
- else
- {
- assert (file->type == MTF_FILE);
- file->next = first_table;
- file->prev = first_table->prev;
- if (first_table->prev)
- first_table->prev->next = file;
- else
- mtf_head = file;
- first_table->prev = file;
- }
-
- lex_match ('=');
-
- if (lex_match ('*'))
- {
- file->handle = NULL;
-
- if (seen & 2)
- {
- msg (SE, _("The active file may not be specified more "
- "than once."));
- goto lossage;
- }
- seen |= 2;
-
- assert (pgm_state != STATE_INPUT);
- if (pgm_state == STATE_INIT)
- {
- msg (SE, _("Cannot specify the active file since no active "
- "file has been defined."));
- goto lossage;
- }
- }
- else
- {
- file->handle = fh_parse_file_handle ();
- if (!file->handle)
- goto lossage;
- }