-#if HAVE_LIBTERMCAP
- static char term_buffer[16384];
-#endif
-
- set_viewwidth = -1;
- set_viewlength = -1;
-
-#if __DJGPP__ || __BORLANDC__
- {
- struct text_info ti;
-
- gettextinfo (&ti);
- set_viewlength = max (ti.screenheight, 25);
- set_viewwidth = max (ti.screenwidth, 79);
- }
-#elif HAVE_LIBTERMCAP
- {
- char *termtype;
- int success;
-
- /* This code stolen from termcap.info, though modified. */
- termtype = getenv ("TERM");
- if (!termtype)
- msg (FE, _("Specify a terminal type with the TERM environment variable."));
-
- success = tgetent (term_buffer, termtype);
- if (success <= 0)
- {
- if (success < 0)
- msg (IE, _("Could not access the termcap data base."));
- else
- msg (IE, _("Terminal type `%s' is not defined."), termtype);
- }
- else
- {
- /* 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;
- }
- }
-#endif /* HAVE_LIBTERMCAP */
-
- /* Try the environment variables */
- if ( -1 == set_viewwidth )
- {
- char *s = getenv("COLUMNS");
- if ( s ) set_viewwidth = atoi(s);
- }
-
- 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;
-
-}
-
-/* Public functions */
-
-void
-init_settings(void)
-{
- cmd.s_dprompt = xstrdup (_("data> "));
- cmd.s_cprompt = xstrdup (" > ");
- cmd.s_prompt = xstrdup ("PSPP> ");
- cmd.s_endcmd = xstrdup (".");
-
- assert(cmd.safe == 0 );
- cmd.safe = STC_OFF;
-
- cmd.dec = STC_DOT;
- cmd.n_cpi[0] = 6;
- cmd.n_lpi[0] = 10;
- cmd.echo = STC_OFF;
- cmd.more = STC_ON;
- cmd.headers = STC_YES;
- cmd.errbrk = STC_OFF;
-
- cmd.scompress = STC_OFF;
- cmd.undef = STC_WARN;
- cmd.mprint = STC_ON ;
- cmd.prtbck = STC_ON ;
- cmd.null = STC_ON ;
- cmd.inc = STC_ON ;
-
- set_journal = xstrdup ("pspp.jnl");
- set_journaling = 1;
-
- 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
- {
- char *pager;
-
- pager = getenv ("STAT_PAGER");
- if (!pager) set_pager = getenv ("PAGER");
-
- if (pager)
- set_pager = xstrdup (pager);
-#if DEFAULT_PAGER
- else
- set_pager = xstrdup (DEFAULT_PAGER);
-#endif /* DEFAULT_PAGER */
- }
-#endif /* !USE_INTERNAL_PAGER */
-
-
- {
- int i;
-
- for (i = 0; i < 5; i++)
- {
- struct set_cust_currency *cc = &set_cc[i];
- strcpy (cc->buf, "-");
- cc->neg_prefix = cc->buf;
- cc->prefix = &cc->buf[1];
- cc->suffix = &cc->buf[1];
- cc->neg_suffix = &cc->buf[1];
- cc->decimal = '.';
- cc->grouping = ',';
- }
- }
-
- if ( ! long_view )