[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pspp-cvs] pspp config/ChangeLog config/devices doc/config...
From: |
Ben Pfaff |
Subject: |
[Pspp-cvs] pspp config/ChangeLog config/devices doc/config... |
Date: |
Wed, 26 Sep 2007 04:24:08 +0000 |
CVSROOT: /cvsroot/pspp
Module name: pspp
Changes by: Ben Pfaff <blp> 07/09/26 04:24:08
Modified files:
config : ChangeLog devices
doc : configuring.texi
src/output : ChangeLog ascii.c
src/ui/terminal: ChangeLog automake.mk main.c read-line.c
Added files:
src/ui/terminal: terminal.c terminal.h
Log message:
Patch #6210: implement ability to resize output device parameters to
fit terminal window size as it changes. Reviewed by John Darrington.
* automake.mk (src_ui_terminal_libui_a_SOURCES): Add new files.
* terminal.c: New file.
* terminal.h: New file.
* main.c (main): No need to set up SIGWINCH handler any longer.
But we do need to call terminal_init.
(set_fallback_viewport): Move to terminal.c.
[HAVE_LIBNCURSES] (get_termcap_viewport): Ditto.
[!HAVE_LIBNCURSES] (get_termcap_viewport): Ditto.
* read-line.c (readln_read): After the first line of a command,
call terminal_check_size to allow it to re-detect the terminal
size.
* ascii.c: Implement ability to resize output device parameters to
fit terminal window size as it changes.
(struct ascii_driver_ext): New members `auto_width',
`auto_length'.
(ascii_open_driver): Initialize new members, call
update_page_size.
(update_page_size): New function to update device size.
(handle_option): Support new "auto" setting for length, width.
(ascii_open_page): Call update_page_size.
* devices (tty-ascii): Set length and width to "auto", so that
they reflect the current size of the terminal window as it
changes.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/pspp/config/ChangeLog?cvsroot=pspp&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/pspp/config/devices?cvsroot=pspp&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/pspp/doc/configuring.texi?cvsroot=pspp&r1=1.15&r2=1.16
http://cvs.savannah.gnu.org/viewcvs/pspp/src/output/ChangeLog?cvsroot=pspp&r1=1.29&r2=1.30
http://cvs.savannah.gnu.org/viewcvs/pspp/src/output/ascii.c?cvsroot=pspp&r1=1.19&r2=1.20
http://cvs.savannah.gnu.org/viewcvs/pspp/src/ui/terminal/ChangeLog?cvsroot=pspp&r1=1.31&r2=1.32
http://cvs.savannah.gnu.org/viewcvs/pspp/src/ui/terminal/automake.mk?cvsroot=pspp&r1=1.16&r2=1.17
http://cvs.savannah.gnu.org/viewcvs/pspp/src/ui/terminal/main.c?cvsroot=pspp&r1=1.40&r2=1.41
http://cvs.savannah.gnu.org/viewcvs/pspp/src/ui/terminal/read-line.c?cvsroot=pspp&r1=1.18&r2=1.19
http://cvs.savannah.gnu.org/viewcvs/pspp/src/ui/terminal/terminal.c?cvsroot=pspp&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/pspp/src/ui/terminal/terminal.h?cvsroot=pspp&rev=1.1
Patches:
Index: config/ChangeLog
===================================================================
RCS file: /cvsroot/pspp/pspp/config/ChangeLog,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- config/ChangeLog 23 Sep 2007 05:59:01 -0000 1.9
+++ config/ChangeLog 26 Sep 2007 04:24:07 -0000 1.10
@@ -1,3 +1,9 @@
+2007-09-25 Ben Pfaff <address@hidden>
+
+ * devices (tty-ascii): Set length and width to "auto", so that
+ they reflect the current size of the terminal window as it
+ changes.
+
2007-09-22 Ben Pfaff <address@hidden>
Bug #21128. Reviewed by John Darrington.
Index: config/devices
===================================================================
RCS file: /cvsroot/pspp/pspp/config/devices,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- config/devices 26 Aug 2007 18:26:29 -0000 1.9
+++ config/devices 26 Sep 2007 04:24:07 -0000 1.10
@@ -50,8 +50,7 @@
# Generic ASCII devices
tty-ascii:ascii:screen:squeeze=on headers=off top-margin=0 bottom-margin=0 \
- paginate=off length=${viewlength} width=${viewwidth} \
- output-file=${tty-output-file}
+ paginate=off length=auto width=auto output-file=${tty-output-file}
list-ascii:ascii:listing:length=66 width=79 output-file=${list-output-file}
raw-ascii:ascii:listing:width=9999 length=9999 output-file=${list-output-file}
\
emphasis=none headers=off paginate=off squeeze=on \
Index: doc/configuring.texi
===================================================================
RCS file: /cvsroot/pspp/pspp/doc/configuring.texi,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- doc/configuring.texi 23 Sep 2007 05:59:02 -0000 1.15
+++ doc/configuring.texi 26 Sep 2007 04:24:07 -0000 1.16
@@ -681,13 +681,17 @@
@item address@hidden
-Physical length of a page, in lines. Headers and margins are subtracted
-from this value. Default: @code{66}.
+Physical length of a page. Headers and margins are subtracted from
+this value. You may specify the number of lines as a number, or for
+screen output you may specify @code{auto} to track the height of the
+terminal as it changes. Default: @code{66}.
@item address@hidden
-Physical width of a page, in characters. Margins are subtracted from
-this value. Default: @code{130}.
+Physical width of a page. Margins are subtracted from this value.
+You may specify the width as a number of characters, or for screen
+output you may specify @code{auto} to track the width of the terminal
+as it changes. Default: @code{79}.
@item address@hidden
Index: src/output/ChangeLog
===================================================================
RCS file: /cvsroot/pspp/pspp/src/output/ChangeLog,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -b -r1.29 -r1.30
--- src/output/ChangeLog 23 Sep 2007 05:59:02 -0000 1.29
+++ src/output/ChangeLog 26 Sep 2007 04:24:07 -0000 1.30
@@ -1,3 +1,17 @@
+2007-09-25 Ben Pfaff <address@hidden>
+
+ Patch #6210. Reviewed by John Darrington.
+
+ * ascii.c: Implement ability to resize output device parameters to
+ fit terminal window size as it changes.
+ (struct ascii_driver_ext): New members `auto_width',
+ `auto_length'.
+ (ascii_open_driver): Initialize new members, call
+ update_page_size.
+ (update_page_size): New function to update device size.
+ (handle_option): Support new "auto" setting for length, width.
+ (ascii_open_page): Call update_page_size.
+
2007-09-22 Ben Pfaff <address@hidden>
Bug #21128. Reviewed by John Darrington.
Index: src/output/ascii.c
===================================================================
RCS file: /cvsroot/pspp/pspp/src/output/ascii.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -b -r1.19 -r1.20
--- src/output/ascii.c 21 Sep 2007 14:12:57 -0000 1.19
+++ src/output/ascii.c 26 Sep 2007 04:24:07 -0000 1.20
@@ -23,6 +23,7 @@
#include <stdlib.h>
#include <data/file-name.h>
+#include <data/settings.h>
#include <libpspp/alloc.h>
#include <libpspp/assertion.h>
#include <libpspp/compiler.h>
@@ -50,8 +51,8 @@
headers=on|off Put headers at top of page?
emphasis=bold|underline|none Style to use for emphasis.
- length=66
- width=130
+ length=66|auto
+ width=79|auto
squeeze=off|on Squeeze multiple newlines into exactly one.
top-margin=2
@@ -110,6 +111,8 @@
const char *chart_type; /* Type of charts to output; NULL for none. */
const char *chart_file_name; /* Name of files used for charts. */
+ bool auto_width; /* Use viewwidth as page width? */
+ bool auto_length; /* Use viewlength as page width? */
int page_length; /* Page length before subtracting margins. */
int top_margin; /* Top margin in lines. */
int bottom_margin; /* Bottom margin in lines. */
@@ -129,6 +132,7 @@
static void ascii_flush (struct outp_driver *);
static int get_default_box_char (size_t idx);
+static bool update_page_size (struct outp_driver *, bool issue_error);
static bool handle_option (struct outp_driver *this, const char *key,
const struct string *val);
@@ -154,6 +158,8 @@
x->tab_width = 8;
x->chart_file_name = pool_strdup (x->pool, "pspp-#.png");
x->chart_type = pool_strdup (x->pool, "png");
+ x->auto_width = false;
+ x->auto_length = false;
x->page_length = 66;
x->top_margin = 2;
x->bottom_margin = 2;
@@ -171,19 +177,8 @@
if (!outp_parse_options (options, handle_option, this))
goto error;
- this->length = x->page_length - x->top_margin - x->bottom_margin - 1;
- if (x->headers)
- this->length -= 3;
-
- if (this->width < 59 || this->length < 15)
- {
- error (0, 0,
- _("ascii: page excluding margins and headers "
- "must be at least 59 characters wide by 15 lines long, but as "
- "configured is only %d characters by %d lines"),
- this->width, this->length);
- return false;
- }
+ if (!update_page_size (this, true))
+ goto error;
for (i = 0; i < LNS_COUNT; i++)
if (x->box[i] == NULL)
@@ -233,6 +228,43 @@
}
}
+/* Re-calculates the page width and length based on settings,
+ margins, and, if "auto" is set, the size of the user's
+ terminal window or GUI output window. */
+static bool
+update_page_size (struct outp_driver *this, bool issue_error)
+{
+ struct ascii_driver_ext *x = this->ext;
+ int margins = x->top_margin + x->bottom_margin + 1 + (x->headers ? 3 : 0);
+
+ if (x->auto_width)
+ this->width = get_viewwidth ();
+ if (x->auto_length)
+ x->page_length = get_viewlength ();
+
+ this->length = x->page_length - margins;
+
+ if (this->width < 59 || this->length < 15)
+ {
+ if (issue_error)
+ error (0, 0,
+ _("ascii: page excluding margins and headers "
+ "must be at least 59 characters wide by 15 lines long, but "
+ "as configured is only %d characters by %d lines"),
+ this->width, this->length);
+ if (this->width < 59)
+ this->width = 59;
+ if (this->length < 15)
+ {
+ this->length = 15;
+ x->page_length = this->length + margins;
+ }
+ return false;
+ }
+
+ return true;
+}
+
static bool
ascii_close_driver (struct outp_driver *this)
{
@@ -251,7 +283,7 @@
boolean_arg,
emphasis_arg,
nonneg_int_arg,
- pos_int_arg,
+ page_size_arg,
string_arg
};
@@ -264,8 +296,8 @@
{"emphasis", emphasis_arg, 0},
- {"length", pos_int_arg, 0},
- {"width", pos_int_arg, 1},
+ {"length", page_size_arg, 0},
+ {"width", page_size_arg, 1},
{"top-margin", nonneg_int_arg, 0},
{"bottom-margin", nonneg_int_arg, 1},
@@ -311,16 +343,36 @@
case -1:
error (0, 0, _("ascii: unknown parameter `%s'"), key);
break;
- case pos_int_arg:
+ case page_size_arg:
{
char *tail;
int arg;
+ if (ss_equals_case (ds_ss (val), ss_cstr ("auto")))
+ {
+ if (!(this->device & OUTP_DEV_SCREEN))
+ {
+ /* We only let `screen' devices have `auto'
+ length or width because output to such devices
+ is flushed before each new command. Resizing
+ a device in the middle of output seems like a
+ bad idea. */
+ error (0, 0, _("ascii: only screen devices may have `auto' "
+ "length or width"));
+ }
+ else if (subcat == 0)
+ x->auto_length = true;
+ else
+ x->auto_width = true;
+ }
+ else
+ {
errno = 0;
arg = strtol (value, &tail, 0);
if (arg < 1 || errno == ERANGE || *tail)
{
- error (0, 0, _("ascii: positive integer required as `%s' value"),
+ error (0, 0, _("ascii: positive integer required as "
+ "`%s' value"),
key);
break;
}
@@ -336,6 +388,7 @@
NOT_REACHED ();
}
}
+ }
break;
case emphasis_arg:
if (!strcmp (value, "bold"))
@@ -448,6 +501,8 @@
struct ascii_driver_ext *x = this->ext;
int i;
+ update_page_size (this, false);
+
if (x->file == NULL)
{
x->file = fn_open (x->file_name, x->append ? "a" : "w");
Index: src/ui/terminal/ChangeLog
===================================================================
RCS file: /cvsroot/pspp/pspp/src/ui/terminal/ChangeLog,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -b -r1.31 -r1.32
--- src/ui/terminal/ChangeLog 25 Sep 2007 04:26:25 -0000 1.31
+++ src/ui/terminal/ChangeLog 26 Sep 2007 04:24:07 -0000 1.32
@@ -1,3 +1,25 @@
+2007-09-25 Ben Pfaff <address@hidden>
+
+ Patch #6210: implement ability to resize output device parameters
+ to fit terminal window size as it changes. Reviewed by John
+ Darrington.
+
+ * automake.mk (src_ui_terminal_libui_a_SOURCES): Add new files.
+
+ * terminal.c: New file.
+
+ * terminal.h: New file.
+
+ * main.c (main): No need to set up SIGWINCH handler any longer.
+ But we do need to call terminal_init.
+ (set_fallback_viewport): Move to terminal.c.
+ [HAVE_LIBNCURSES] (get_termcap_viewport): Ditto.
+ [!HAVE_LIBNCURSES] (get_termcap_viewport): Ditto.
+
+ * read-line.c (readln_read): After the first line of a command,
+ call terminal_check_size to allow it to re-detect the terminal
+ size.
+
2007-09-24 Ben Pfaff <address@hidden>
Patch #6210. Reviewed by John Darrington.
Index: src/ui/terminal/automake.mk
===================================================================
RCS file: /cvsroot/pspp/pspp/src/ui/terminal/automake.mk,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -b -r1.16 -r1.17
--- src/ui/terminal/automake.mk 27 Mar 2007 09:16:57 -0000 1.16
+++ src/ui/terminal/automake.mk 26 Sep 2007 04:24:08 -0000 1.17
@@ -9,7 +9,9 @@
src/ui/terminal/read-line.h \
src/ui/terminal/main.c \
src/ui/terminal/msg-ui.c \
- src/ui/terminal/msg-ui.h
+ src/ui/terminal/msg-ui.h \
+ src/ui/terminal/terminal.c \
+ src/ui/terminal/terminal.h
src_ui_terminal_libui_a_CFLAGS = -DINSTALLDIR=\"$(bindir)\"
Index: src/ui/terminal/main.c
===================================================================
RCS file: /cvsroot/pspp/pspp/src/ui/terminal/main.c,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -b -r1.40 -r1.41
--- src/ui/terminal/main.c 25 Sep 2007 04:19:11 -0000 1.40
+++ src/ui/terminal/main.c 26 Sep 2007 04:24:08 -0000 1.41
@@ -1,5 +1,5 @@
/* PSPP - a program for statistical analysis.
- Copyright (C) 1997-9, 2000, 2006 Free Software Foundation, Inc.
+ 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
@@ -16,14 +16,19 @@
#include <config.h>
+#include <locale.h>
#include <signal.h>
#include <stdio.h>
-
-#include <ui/debugger.h>
-#include "command-line.h"
-#include "msg-ui.h"
-#include "progname.h"
-#include "read-line.h"
+#include <stdlib.h>
+#if HAVE_FPU_CONTROL_H
+#include <fpu_control.h>
+#endif
+#if HAVE_FENV_H
+#include <fenv.h>
+#endif
+#if HAVE_IEEEFP_H
+#include <ieeefp.h>
+#endif
#include <data/dictionary.h>
#include <data/file-handle-def.h>
@@ -42,27 +47,17 @@
#include <libpspp/version.h>
#include <math/random.h>
#include <output/output.h>
+#include <ui/debugger.h>
+#include <ui/terminal/command-line.h>
+#include <ui/terminal/msg-ui.h>
+#include <ui/terminal/read-line.h>
+#include <ui/terminal/terminal.h>
-#if HAVE_FPU_CONTROL_H
-#include <fpu_control.h>
-#endif
-
-#if HAVE_LOCALE_H
-#include <locale.h>
-#endif
-
-#if HAVE_FENV_H
-#include <fenv.h>
-#endif
-
-#if HAVE_IEEEFP_H
-#include <ieeefp.h>
-#endif
+#include "progname.h"
#include "gettext.h"
#define _(msgid) gettext (msgid)
-#include <stdlib.h>
static void i18n_init (void);
static void fpu_init (void);
@@ -78,23 +73,18 @@
static struct lexer *the_lexer;
static struct source_stream *the_source_stream ;
-static int view_length = -1;
-static int view_width = -1;
-
-static void get_termcap_viewport (int);
-
-
/* Program entry point. */
int
main (int argc, char **argv)
{
+ int *view_width_p, *view_length_p;
+
+ set_program_name (argv[0]);
+
signal (SIGABRT, bug_handler);
signal (SIGSEGV, bug_handler);
signal (SIGFPE, bug_handler);
signal (SIGINT, interrupt_handler);
- signal (SIGWINCH, get_termcap_viewport);
-
- set_program_name (argv[0]);
i18n_init ();
fpu_init ();
@@ -110,8 +100,8 @@
);
prompt_init ();
readln_initialize ();
- get_termcap_viewport (0);
- settings_init (&view_width, &view_length);
+ terminal_init (&view_width_p, &view_length_p);
+ settings_init (view_width_p, view_length_p);
random_init ();
the_dataset = create_dataset ();
@@ -231,73 +221,3 @@
}
exit (success ? EXIT_SUCCESS : EXIT_FAILURE);
}
-
-
-#include "error.h"
-
-#include "gettext.h"
-#define _(msgid) gettext (msgid)
-
-/* If view_width or view_length has not yet been set to a
- reasonable value, takes a guess. */
-static void
-set_fallback_viewport (void)
-{
- if (view_width <= 0)
- {
- if (getenv ("COLUMNS") != NULL)
- view_width = atoi (getenv ("COLUMNS"));
- if (view_width <= 0)
- view_width = 79;
- }
-
- if (view_length <= 0)
- {
- if (getenv ("LINES") != NULL)
- view_length = atoi (getenv ("LINES"));
- if (view_length <= 0)
- view_length = 24;
- }
-}
-
-/* Code that interfaces to ncurses. This must be at the very end
- of this file because curses.h redefines "bool" on some systems
- (e.g. OpenBSD), causing declaration mismatches with functions
- that have parameters or return values of type "bool". */
-#if HAVE_LIBNCURSES
-#include <curses.h>
-#include <term.h>
-
-static void
-get_termcap_viewport (int sig UNUSED)
-{
- char term_buffer [16384];
-
- if (getenv ("TERM") != NULL)
- {
- if (tgetent (term_buffer, getenv ("TERM")) > 0)
- {
- if (tgetnum ("li") > 0)
- view_length = tgetnum ("li");
- if (tgetnum ("co") > 1)
- view_width = tgetnum ("co") - 1;
- }
- else
- error (0, 0, _("could not access definition for terminal `%s'"),
- getenv ("TERM"));
- }
-
- set_fallback_viewport ();
-}
-
-#else /* !HAVE_LIBNCURSES */
-
-static void
-get_termcap_viewport (int sig UNUSED)
-{
- set_fallback_viewport ();
-}
-
-#endif /* !HAVE_LIBNCURSES */
-
-
Index: src/ui/terminal/read-line.c
===================================================================
RCS file: /cvsroot/pspp/pspp/src/ui/terminal/read-line.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -b -r1.18 -r1.19
--- src/ui/terminal/read-line.c 5 Sep 2007 06:23:04 -0000 1.18
+++ src/ui/terminal/read-line.c 26 Sep 2007 04:24:08 -0000 1.19
@@ -34,6 +34,7 @@
#include <language/prompt.h>
#include <output/journal.h>
#include <output/manager.h>
+#include <ui/terminal/terminal.h>
#include "xalloc.h"
@@ -143,6 +144,7 @@
#if HAVE_READLINE
char *string;
#endif
+ bool eof;
assert (initialised);
@@ -159,14 +161,14 @@
: dont_complete);
string = readline (prompt);
if (string == NULL)
- return false;
+ eof = true;
else
{
if (string[0])
add_history (string);
ds_assign_cstr (line, string);
free (string);
- return true;
+ eof = false;
}
#else
fputs (prompt, stdout);
@@ -174,13 +176,23 @@
if (ds_read_line (line, stdin))
{
ds_chomp (line, '\n');
- return true;
+ eof = false;
}
else
- return false;
+ eof = true;
#endif
-}
+ /* Check whether the size of the window has changed, so that
+ the output drivers can adjust their settings as needed. We
+ only do this for the first line of a command, as it's
+ possible that the output drivers are actually in use
+ afterward, and we don't want to confuse them in the middle
+ of output. */
+ if (style == PROMPT_FIRST)
+ terminal_check_size ();
+
+ return !eof;
+}
static void
readln_close (struct getl_interface *i)
Index: src/ui/terminal/terminal.c
===================================================================
RCS file: src/ui/terminal/terminal.c
diff -N src/ui/terminal/terminal.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/ui/terminal/terminal.c 26 Sep 2007 04:24:08 -0000 1.1
@@ -0,0 +1,92 @@
+/* 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 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.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#include <config.h>
+
+#include <ui/terminal/terminal.h>
+
+#include <stdbool.h>
+#include <stdlib.h>
+
+#include <libpspp/compiler.h>
+
+#include "error.h"
+
+#include "gettext.h"
+#define _(msgid) gettext (msgid)
+
+static int view_width = -1;
+static int view_length = -1;
+
+/* Initializes the terminal interface by determining the size of
+ the user's terminal. Stores a pointer to the size variables
+ in *VIEW_WIDTH_P and *VIEW_LENGTH_P. */
+void
+terminal_init (int **view_width_p, int **view_length_p)
+{
+ *view_width_p = &view_width;
+ *view_length_p = &view_length;
+ terminal_check_size ();
+}
+
+/* Code that interfaces to ncurses. This must be at the very end
+ of this file because curses.h redefines "bool" on some systems
+ (e.g. OpenBSD), causing declaration mismatches with functions
+ that have parameters or return values of type "bool". */
+#if HAVE_LIBNCURSES
+#include <curses.h>
+#include <term.h>
+#endif
+
+/* Determines the size of the terminal, if possible, or at least
+ takes an educated guess. */
+void
+terminal_check_size (void)
+{
+#if HAVE_LIBNCURSES
+ if (getenv ("TERM") != NULL)
+ {
+ char term_buffer [16384];
+
+ if (tgetent (term_buffer, getenv ("TERM")) > 0)
+ {
+ if (tgetnum ("li") > 0)
+ view_length = tgetnum ("li");
+ if (tgetnum ("co") > 1)
+ view_width = tgetnum ("co") - 1;
+ }
+ else
+ error (0, 0, _("could not access definition for terminal `%s'"),
+ getenv ("TERM"));
+ }
+#endif
+
+ if (view_width <= 0)
+ {
+ if (getenv ("COLUMNS") != NULL)
+ view_width = atoi (getenv ("COLUMNS"));
+ if (view_width <= 0)
+ view_width = 79;
+ }
+
+ if (view_length <= 0)
+ {
+ if (getenv ("LINES") != NULL)
+ view_length = atoi (getenv ("LINES"));
+ if (view_length <= 0)
+ view_length = 24;
+ }
+}
Index: src/ui/terminal/terminal.h
===================================================================
RCS file: src/ui/terminal/terminal.h
diff -N src/ui/terminal/terminal.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/ui/terminal/terminal.h 26 Sep 2007 04:24:08 -0000 1.1
@@ -0,0 +1,23 @@
+/* PSPP - a program for statistical analysis.
+ Copyright (C) 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 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.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#ifndef UI_TERMINAL_TERMINAL_H
+#define UI_TERMINAL_TERMINAL_H 1
+
+void terminal_init (int **view_width_p, int **view_length_p);
+void terminal_check_size (void);
+
+#endif /* ui/terminal/terminal.h */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pspp-cvs] pspp config/ChangeLog config/devices doc/config...,
Ben Pfaff <=