X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fdata%2Fsettings.c;h=4d0ef3eb03ddbaad947c38255aa68c393c6280bf;hb=5c891f46234618f733ed1f3e0be6deedef3e487d;hp=ddcc588a1fcaeb59fbe4343572adbe806403f0b5;hpb=f5c108becd49d78f4898cab11352291f5689d24e;p=pspp
diff --git a/src/data/settings.c b/src/data/settings.c
index ddcc588a1f..4d0ef3eb03 100644
--- a/src/data/settings.c
+++ b/src/data/settings.c
@@ -1,20 +1,18 @@
-/* PSPP - computes sample statistics.
- Copyright (C) 1997-9, 2000, 2006 Free Software Foundation, Inc.
+/* PSPP - a program for statistical analysis.
+ Copyright (C) 1997-9, 2000, 2006, 2007 Free Software Foundation, Inc.
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- 02110-1301, USA. */
+ along with this program. If not, see . */
#include
#include "settings.h"
@@ -26,13 +24,17 @@
#include "xalloc.h"
#include
-static int viewlength = 24;
-static int viewwidth = 79;
-static bool long_view = false;
+#include "error.h"
+
+#include "gettext.h"
+#define _(msgid) gettext (msgid)
+
+static int *viewlength = NULL;
+static int *viewwidth = NULL;
static bool safer_mode = false;
-static bool echo = false;
+static bool do_echo = false;
static bool include = true;
static int epoch = -1;
@@ -71,12 +73,12 @@ static int *algorithm = &global_algorithm;
static int syntax = ENHANCED;
-static void init_viewport (void);
+static void init_viewport (int *, int *);
void
-settings_init (void)
+settings_init (int *width, int *length)
{
- init_viewport ();
+ init_viewport (width, length);
i18n_init ();
}
@@ -90,81 +92,35 @@ settings_done (void)
int
get_viewlength (void)
{
- return viewlength;
+ return *viewlength;
}
/* Sets the view length. */
void
set_viewlength (int viewlength_)
{
- viewlength = viewlength_;
-}
-
-/* Set view width to a very long value, and prevent it from ever
- changing. */
-void
-force_long_view (void)
-{
- long_view = true;
- viewwidth = 9999;
+ *viewlength = viewlength_;
}
/* Screen width. */
int
get_viewwidth(void)
{
- return viewwidth;
+ return *viewwidth;
}
/* Sets the screen width. */
void
set_viewwidth (int viewwidth_)
{
- viewwidth = viewwidth_;
-}
-
-#if HAVE_LIBTERMCAP
-static void
-get_termcap_viewport (void)
-{
- char term_buffer[16384];
- if (getenv ("TERM") == NULL)
- return;
- else if (tgetent (term_buffer, getenv ("TERM")) <= 0)
- {
- msg (IE, _("Could not access definition for terminal `%s'."), termtype);
- return;
- }
-
- if (tgetnum ("li") > 0)
- viewlength = tgetnum ("li");
-
- if (tgetnum ("co") > 1)
- viewwidth = tgetnum ("co") - 1;
+ *viewwidth = viewwidth_;
}
-#endif /* HAVE_LIBTERMCAP */
static void
-init_viewport (void)
+init_viewport (int *width, int *length)
{
- if (long_view)
- return;
-
- viewwidth = viewlength = -1;
-
-#if HAVE_LIBTERMCAP
- get_termcap_viewport ();
-#endif /* HAVE_LIBTERMCAP */
-
- if (viewwidth < 0 && getenv ("COLUMNS") != NULL)
- viewwidth = atoi (getenv ("COLUMNS"));
- if (viewlength < 0 && getenv ("LINES") != NULL)
- viewlength = atoi (getenv ("LINES"));
-
- if (viewwidth < 0)
- viewwidth = 79;
- if (viewlength < 0)
- viewlength = 24;
+ viewwidth = width;
+ viewlength = length;
}
/* Whether PSPP can erase and overwrite files. */
@@ -185,14 +141,14 @@ set_safer_mode (void)
bool
get_echo (void)
{
- return echo;
+ return do_echo;
}
/* Set echo. */
void
set_echo (bool echo_)
{
- echo = echo_;
+ do_echo = echo_;
}
/* If echo is on, whether commands from include files are echoed. */