[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pspp-cvs] pspp/src/ui/terminal ChangeLog main.c
From: |
Ben Pfaff |
Subject: |
[Pspp-cvs] pspp/src/ui/terminal ChangeLog main.c |
Date: |
Tue, 25 Sep 2007 04:19:12 +0000 |
CVSROOT: /cvsroot/pspp
Module name: pspp
Changes by: Ben Pfaff <blp> 07/09/25 04:19:12
Modified files:
src/ui/terminal: ChangeLog main.c
Log message:
(set_fallback_viewport): Make code easier to understand.
(get_termcap_viewport): Ditto.
Reviewed by John Darrington.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/pspp/src/ui/terminal/ChangeLog?cvsroot=pspp&r1=1.29&r2=1.30
http://cvs.savannah.gnu.org/viewcvs/pspp/src/ui/terminal/main.c?cvsroot=pspp&r1=1.39&r2=1.40
Patches:
Index: ChangeLog
===================================================================
RCS file: /cvsroot/pspp/pspp/src/ui/terminal/ChangeLog,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -b -r1.29 -r1.30
--- ChangeLog 25 Sep 2007 04:16:20 -0000 1.29
+++ ChangeLog 25 Sep 2007 04:19:11 -0000 1.30
@@ -1,3 +1,9 @@
+2007-09-24 Ben Pfaff <address@hidden>
+
+ * main.c (set_fallback_viewport): Make code easier to understand.
+ (get_termcap_viewport): Ditto.
+ Reviewed by John Darrington.
+
2007-09-19 John Darrington <address@hidden>
* main.c: Moved get_termcap_viewport from src/data/settings.c
Index: main.c
===================================================================
RCS file: /cvsroot/pspp/pspp/src/ui/terminal/main.c,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -b -r1.39 -r1.40
--- main.c 25 Sep 2007 04:16:20 -0000 1.39
+++ main.c 25 Sep 2007 04:19:11 -0000 1.40
@@ -233,26 +233,31 @@
}
-
#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 && getenv ("COLUMNS") != NULL)
+ if (view_width <= 0)
+ {
+ if (getenv ("COLUMNS") != NULL)
view_width = atoi (getenv ("COLUMNS"));
-
- if (view_length < 0 && getenv ("LINES") != NULL)
- view_length = atoi (getenv ("LINES"));
-
- if (view_width < 0)
+ if (view_width <= 0)
view_width = 79;
+ }
- if (view_length < 0)
+ 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
@@ -268,23 +273,20 @@
{
char term_buffer [16384];
- if (getenv ("TERM") == NULL)
- goto fallback;
-
- else if (tgetent (term_buffer, getenv ("TERM")) <= 0)
+ if (getenv ("TERM") != NULL)
+ {
+ if (tgetent (term_buffer, getenv ("TERM")) > 0)
{
- error (0,0, _("could not access definition for terminal `%s'"),
- getenv ("TERM"));
- goto fallback;
- }
-
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"));
+ }
- fallback:
set_fallback_viewport ();
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pspp-cvs] pspp/src/ui/terminal ChangeLog main.c,
Ben Pfaff <=