projects
/
pspp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix regression in command name completion reported by John Darrington.
[pspp]
/
src
/
language
/
data-io
/
print.c
diff --git
a/src/language/data-io/print.c
b/src/language/data-io/print.c
index 52828400f9382194b4e3c25f0e3f95f06612b7d2..061aafc628f89fb56dadb55b3d4138badf316063 100644
(file)
--- a/
src/language/data-io/print.c
+++ b/
src/language/data-io/print.c
@@
-20,21
+20,26
@@
/* FIXME: seems like a lot of code duplication with data-list.c. */
#include <config.h>
/* FIXME: seems like a lot of code duplication with data-list.c. */
#include <config.h>
-#include <libpspp/message.h>
+
#include <stdlib.h>
#include <stdlib.h>
-#include <libpspp/alloc.h>
+
#include <data/case.h>
#include <data/case.h>
+#include <data/procedure.h>
+#include <data/transformations.h>
+#include <data/variable.h>
#include <language/command.h>
#include <language/command.h>
-#include <libpspp/compiler.h>
#include <language/data-io/data-writer.h>
#include <language/data-io/data-writer.h>
-#include <libpspp/message.h>
-#include <language/expressions/public.h>
#include <language/data-io/file-handle.h>
#include <language/data-io/file-handle.h>
+#include <language/expressions/public.h>
#include <language/lexer/lexer.h>
#include <language/lexer/lexer.h>
+#include <language/lexer/variable-parser.h>
+#include <libpspp/alloc.h>
+#include <libpspp/compiler.h>
+#include <libpspp/message.h>
+#include <libpspp/message.h>
#include <libpspp/misc.h>
#include <output/manager.h>
#include <output/table.h>
#include <libpspp/misc.h>
#include <output/manager.h>
#include <output/table.h>
-#include <data/variable.h>
#include "gettext.h"
#define _(msgid) gettext (msgid)
#include "gettext.h"
#define _(msgid) gettext (msgid)
@@
-137,7
+142,7
@@
static int
internal_cmd_print (int f)
{
int table = 0; /* Print table? */
internal_cmd_print (int f)
{
int table = 0; /* Print table? */
- struct print_trns *trns
;
/* malloc()'d transformation. */
+ struct print_trns *trns
= NULL;
/* malloc()'d transformation. */
struct file_handle *fh = NULL;
/* Fill in prt to facilitate error-handling. */
struct file_handle *fh = NULL;
/* Fill in prt to facilitate error-handling. */
@@
-346,7
+351,7
@@
parse_string_argument (void)
{
fx.spec.type = PRT_CONST;
fx.spec.fc = fx.sc - 1;
{
fx.spec.type = PRT_CONST;
fx.spec.fc = fx.sc - 1;
- fx.spec.u.c =
xstrdup (ds_c_str (&tokstr)
);
+ fx.spec.u.c =
ds_xstrdup (&tokstr
);
lex_get ();
/* Parse the included column range. */
lex_get ();
/* Parse the included column range. */
@@
-846,13
+851,6
@@
dump_table (const struct file_handle *fh)
tab_submit (t);
}
tab_submit (t);
}
-/* PORTME: The number of characters in a line terminator. */
-#ifdef __MSDOS__
-#define LINE_END_WIDTH 2 /* \r\n */
-#else
-#define LINE_END_WIDTH 1 /* \n */
-#endif
-
/* Calculates the maximum possible line width and allocates a buffer
big enough to contain it */
static void
/* Calculates the maximum possible line width and allocates a buffer
big enough to contain it */
static void
@@
-891,7
+889,7
@@
alloc_line (void)
if (pot_w > w)
w = pot_w;
}
if (pot_w > w)
w = pot_w;
}
- prt.max_width = w +
LINE_END_WIDTH + 1
;
+ prt.max_width = w +
2
;
prt.line = xmalloc (prt.max_width);
}
\f
prt.line = xmalloc (prt.max_width);
}
\f
@@
-933,13
+931,7
@@
print_trns_proc (void *trns_, struct ccase *c, int case_num UNUSED)
{
if ((t->options & PRT_CMD_MASK) == PRT_PRINT
|| !(t->options & PRT_BINARY))
{
if ((t->options & PRT_CMD_MASK) == PRT_PRINT
|| !(t->options & PRT_BINARY))
- {
- /* PORTME: Line ends. */
-#ifdef __MSDOS__
- buf[len++] = '\r';
-#endif
- buf[len++] = '\n';
- }
+ buf[len++] = '\n';
dfm_put_record (t->writer, buf, len);
}
dfm_put_record (t->writer, buf, len);
}
@@
-975,7
+967,7
@@
print_trns_proc (void *trns_, struct ccase *c, int case_num UNUSED)
return TRNS_CONTINUE;
}
return TRNS_CONTINUE;
}
-/* Frees all the data inside print_trns
T. Does not free
T. */
+/* Frees all the data inside print_trns
PRT. Does not free PR
T. */
static bool
print_trns_free (void *prt_)
{
static bool
print_trns_free (void *prt_)
{
@@
-1005,7
+997,6
@@
print_trns_free (void *prt_)
if (prt->writer != NULL)
ok = dfm_close_writer (prt->writer);
free (prt->line);
if (prt->writer != NULL)
ok = dfm_close_writer (prt->writer);
free (prt->line);
- free (prt);
return ok;
}
\f
return ok;
}
\f