#include <config.h>
#include "settings.h"
-#include <assert.h>
+#include "error.h"
#include <stdio.h>
#include <errno.h>
#include <stdlib.h>
listing=custom;
log=custom;
lowres=lores:auto/on/off;
- lpi=integer "x>0" "% must be greater than 0";
+ lpi=integer "x>0" "%s must be greater than 0";
menus=menus:standard/extended;
messages=messages:on/off/terminal/listing/both/none;
mexpand=mexp:on/off;
cmd_set (void)
{
- lex_match_id ("SET");
-
if (!parse_set (&cmd))
return CMD_FAILURE;
return 0;
if (set_pager)
free (set_pager);
- set_pager = xstrdup (ds_value (&tokstr));
+ set_pager = xstrdup (ds_c_str (&tokstr));
lex_get ();
}
return 1;
set_journaling = 0;
if (token == T_STRING)
{
- set_journal = xstrdup (ds_value (&tokstr));
+ set_journal = xstrdup (ds_c_str (&tokstr));
lex_get ();
}
return 1;
static void
-set_viewport(void)
+set_viewport(int sig_num UNUSED)
{
#if HAVE_LIBTERMCAP
static char term_buffer[16384];
#endif
- /* Workable defaults before we determine the real terminal size. */
- set_viewwidth = 79;
- set_viewlength = 24;
-
-
+ set_viewwidth = -1;
+ set_viewlength = -1;
#if __DJGPP__ || __BORLANDC__
{
/* This code stolen from termcap.info, though modified. */
termtype = getenv ("TERM");
if (!termtype)
- msg (FE, _("Specify a terminal type with `setenv TERM <yourtype>'."));
+ msg (FE, _("Specify a terminal type with the TERM environment variable."));
success = tgetent (term_buffer, termtype);
if (success <= 0)
}
else
{
- set_viewlength = tgetnum ("li");
- set_viewwidth = tgetnum ("co") - 1;
+ /* NOTE: Do not rely upon tgetnum returning -1 if the value is
+ not available. It's supposed to do it, but not all platforms
+ do (eg Cygwin) .
+ */
+ if ( -1 != tgetnum("li"))
+ set_viewlength = tgetnum ("li");
+
+ if ( -1 != tgetnum("co"))
+ set_viewwidth = tgetnum ("co") - 1;
}
}
-#else
- {
- char *s;
+#endif /* HAVE_LIBTERMCAP */
/* Try the environment variables */
- s = getenv("COLUMNS");
- if ( s ) set_viewwidth = atoi(s);
+ if ( -1 == set_viewwidth )
+ {
+ char *s = getenv("COLUMNS");
+ if ( s ) set_viewwidth = atoi(s);
+ }
- s = getenv("LINES");
- if ( s ) set_viewlength = atoi(s);
- }
-#endif /* !HAVE_LIBTERMCAP */
+ if ( -1 == set_viewwidth )
+ {
+ char *s = getenv("LINES");
+ if ( s ) set_viewlength = atoi(s);
+ }
+
+
+ /* Last resort. Use hard coded values */
+ if ( 0 > set_viewwidth ) set_viewwidth = 79;
+ if ( 0 > set_viewlength ) set_viewlength = 24;
}
cmd.safe = STC_OFF;
cmd.dec = STC_DOT;
- cmd.n_cpi = 6;
- cmd.n_lpi = 10;
+ cmd.n_cpi[0] = 6;
+ cmd.n_lpi[0] = 10;
cmd.echo = STC_OFF;
cmd.more = STC_ON;
cmd.headers = STC_YES;
set_journal = xstrdup ("pspp.jnl");
set_journaling = 1;
- cmd.n_mxwarns = 100;
- cmd.n_mxerrs = 100;
- cmd.n_mxloops = 1;
- cmd.n_workspace = 4L * 1024 * 1024;
+ cmd.n_mxwarns[0] = 100;
+ cmd.n_mxerrs[0] = 100;
+ cmd.n_mxloops[0] = 1;
+ cmd.n_workspace[0] = 4L * 1024 * 1024;
#if !USE_INTERNAL_PAGER
if ( ! long_view )
{
- set_viewport();
- signal (SIGWINCH,set_viewport);
+ set_viewport (0);
+ signal (SIGWINCH, set_viewport);
}
}
int
get_mxwarns(void)
{
- return cmd.n_mxwarns;
+ return cmd.n_mxwarns[0];
}
int
get_mxerrs(void)
{
- return cmd.n_mxerrs;
+ return cmd.n_mxerrs[0];
}
int
int
get_mxloops(void)
{
- return cmd.n_mxloops;
+ return cmd.n_mxloops[0];
}
int
size_t
get_max_workspace(void)
{
- return cmd.n_workspace;
+ return cmd.n_workspace[0];
}
double
}
+static int global_algorithm = ENHANCED;
+static int cmd_algorithm = ENHANCED;
+static int *algorithm = &global_algorithm;
+
+static int syntax = ENHANCED;
+
+/* Set the algorithm option globally */
+void
+set_algorithm(int x)
+{
+ global_algorithm = x;
+}
+
+/* Set the algorithm option for this command only */
+void
+set_cmd_algorithm(int x)
+{
+ cmd_algorithm = x;
+ algorithm = &cmd_algorithm;
+}
+
+/* Unset the algorithm option for this command */
+void
+unset_cmd_algorithm(void)
+{
+ algorithm = &global_algorithm;
+}
+
+/* Return the current algorithm setting */
+int
+get_algorithm(void)
+{
+ return *algorithm;
+}
+
+/* Set the syntax option */
+void
+set_syntax(int x)
+{
+ syntax = x;
+}
+
+/* Get the current syntax setting */
+int
+get_syntax(void)
+{
+ return syntax;
+}
+
+
/*
Local Variables:
mode: c