Fixed lsec for terminals that do not support getting the terminal width. stable-1.3
authorFlorian Pose <fp@igh-essen.com>
Thu, 02 Oct 2008 09:56:39 +0000
branchstable-1.3
changeset 1760 036f19bde00b
parent 1759 c3b4d3a50ac6
Fixed lsec for terminals that do not support getting the terminal width.
Makefile.am
script/lsec
--- a/Makefile.am	Thu Oct 02 08:08:26 2008 +0000
+++ b/Makefile.am	Thu Oct 02 09:56:39 2008 +0000
@@ -59,7 +59,7 @@
 		svnversion $(srcdir) 2>/dev/null >$(distdir)/svnrevision; \
 	fi
 	if which svn2cl >/dev/null 2>&1; then \
-        svn2cl svn://yak/vol/projekte/msr_messen_steuern_regeln/ethercat/rep; \
+        svn2cl svn://svn/vol/projekte/msr_messen_steuern_regeln/ethercat/rep; \
     fi
 
 mrproper: clean cleandoc
--- a/script/lsec	Thu Oct 02 08:08:26 2008 +0000
+++ b/script/lsec	Thu Oct 02 09:56:39 2008 +0000
@@ -213,15 +213,20 @@
 
 sub get_terminal_width
 {
-    my $winsize;
-    die "no TIOCGWINSZ " unless defined &TIOCGWINSZ;
-    open(TTY, "+</dev/tty") or die "No tty: $!";
-    unless (ioctl(TTY, &TIOCGWINSZ, $winsize='')) {
-        die sprintf "$0: ioctl TIOCGWINSZ (%08x: $!)\n", &TIOCGWINSZ;
-    }
-    (my $row, my $col, my $xpixel, my $ypixel) = unpack('S4', $winsize);
+    my $col = 50;
+
+    if (defined &TIOCGWINSZ) {
+        my $winsize;
+        open(TTY, "+</dev/tty") or die "No tty: $!";
+        unless (ioctl(TTY, &TIOCGWINSZ, $winsize='')) {
+            die sprintf "$0: ioctl TIOCGWINSZ (%08x: $!)\n", &TIOCGWINSZ;
+        }
+        (my $row, $col, my $xpixel, my $ypixel) = unpack('S4', $winsize);
+    }
+
     return $col;
 }
+
 #------------------------------------------------------------------------------
 
 sub print_line