projects
/
pspp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Make the expression code a little nicer and fix bugs found
[pspp]
/
src
/
title.c
diff --git
a/src/title.c
b/src/title.c
index dca7b4760777b96e267808719b6dcf3930f41c38..cb56f84db2db7e38a57b2b7d543b83ac93b3bca7 100644
(file)
--- a/
src/title.c
+++ b/
src/title.c
@@
-75,6
+75,7
@@
get_title (const char *cmd, char **title)
if (*title)
free (*title);
*title = xstrdup (lex_rest_of_line (NULL));
if (*title)
free (*title);
*title = xstrdup (lex_rest_of_line (NULL));
+ lex_discard_line ();
for (cp = *title; *cp; cp++)
*cp = toupper ((unsigned char) (*cp));
token = '.';
for (cp = *title; *cp; cp++)
*cp = toupper ((unsigned char) (*cp));
token = '.';
@@
-87,9
+88,10
@@
get_title (const char *cmd, char **title)
int
cmd_file_label (void)
{
int
cmd_file_label (void)
{
- char *label;
+ c
onst c
har *label;
label = lex_rest_of_line (NULL);
label = lex_rest_of_line (NULL);
+ lex_discard_line ();
while (isspace ((unsigned char) *label))
label++;
while (isspace ((unsigned char) *label))
label++;
@@
-143,20
+145,21
@@
cmd_document (void)
for (;;)
{
int had_dot;
for (;;)
{
int had_dot;
- char *line;
+ const char *orig_line;
+ char *copy_line;
- line = lex_rest_of_line (&had_dot);
- while (isspace ((unsigned char) *line))
- line++;
+ orig_line = lex_rest_of_line (&had_dot);
+ lex_discard_line ();
+ while (isspace ((unsigned char) *orig_line))
+ orig_line++;
+ copy_line = xmalloc (strlen (orig_line) + 2);
+ strcpy (copy_line, orig_line);
if (had_dot)
if (had_dot)
- {
- char *cp = strchr (line, 0);
- *cp++ = '.';
- *cp = 0;
- }
+ strcat (copy_line, ".");
- add_document_line (line, 3);
+ add_document_line (copy_line, 3);
+ free (copy_line);
lex_get_line ();
if (had_dot)
lex_get_line ();
if (had_dot)
@@
-171,9
+174,6
@@
cmd_document (void)
int
cmd_drop_documents (void)
{
int
cmd_drop_documents (void)
{
- lex_match_id ("DROP");
- lex_match_id ("DOCUMENTS");
-
dict_set_documents (default_dict, NULL);
return lex_end_of_command ();
dict_set_documents (default_dict, NULL);
return lex_end_of_command ();