- int i;
- int n_lines = 0;
- char buf[256];
- struct string *lines = NULL;
-
- sprintf (buf, _("(Entered %s)"), get_start_date ());
-
- if ( ! lex_force_string (lexer) )
- return CMD_FAILURE;
-
- while ( lex_is_string (lexer))
- {
- const struct string *s = lex_tokstr (lexer);
- if ( ds_length (s) > 80)
- {
- /* Note to translators: "bytes" is correct, not characters */
- msg (SE, _("Document lines may not be more than 80 bytes long."));
- goto failure;
-
- }
- lines = xrealloc (lines, (n_lines + 1) * sizeof (*lines));
- ds_init_string (&lines[n_lines++], s);
-
- lex_get (lexer);
- }
-
- for ( i = 0 ; i < n_lines ; ++i)
- {
- add_document_line (dataset_dict (ds), ds_cstr (&lines[i]), 0);
- ds_destroy (&lines[i]);
- }
-
- free (lines);
-
- add_document_line (dataset_dict (ds), buf, 3);
-
- return lex_end_of_command (lexer) ;
-
- failure:
- for ( i = 0 ; i < n_lines ; ++i)
- ds_destroy (&lines[i]);
-
- free (lines);
-
- return CMD_FAILURE;