Package: ipcalc
Version: 0.41-1
Severity: normal
Tags: patch
2008-05-07 Jari Aalto <[EMAIL PROTECTED]>
* ipcalc (getopts): Inside Emacs, do not activate colors
by default.
(read_opts): Add '-c' to turn on colors.
(usage): Document new option '-c|-color'.
>From 4e17caae5984a08f90ac2a27178535910e53a193 Mon Sep 17 00:00:00 2001
From: Jari Aalto <[EMAIL PROTECTED]>
Date: Wed, 7 May 2008 10:15:42 +0300
Subject: [PATCH] ipcalc: Inside Emacs, do not use colors
Signed-off-by: Jari Aalto <[EMAIL PROTECTED]>
---
ipcalc | 12 +++++++++++-
1 files changed, 11 insertions(+), 1 deletions(-)
diff --git a/ipcalc b/ipcalc
index b9d659b..ba8220d 100755
--- a/ipcalc
+++ b/ipcalc
@@ -708,7 +708,13 @@ sub getopts
if (-t STDOUT) {
$opt_color = 1;
}
-
+
+ # Under Emacs, do not use colors by default. The TERM is for older
+ # Emacs versions.
+ if ( $ENV{'TERM'} =~ /dumb/i or $ENV{'INSIDE_EMACS'} ) {
+ $opt_color = 0;
+ }
+
while (has_opts()) {
$arg = shift @ARGV;
if ($arg =~ /^--(.+)/) {
@@ -781,6 +787,9 @@ sub getopts
elsif ($opt eq 'help') {
$opt_help = 1;
}
+ elsif ($opt eq 'c' || $opt eq 'color') {
+ $opt_color = 1;
+ }
elsif ($opt eq 'n' || $opt eq 'nocolor') {
$opt_color = 0;
}
@@ -1047,6 +1056,7 @@ can design sub- and supernetworks. It is also intended to
be a teaching tool
and presents the results as easy-to-understand binary values.
-n --nocolor Don't display ANSI color codes.
+ -c --color Display ANSI color codes (default).
-b --nobinary Suppress the bitwise output.
-c --class Just print bit-count-mask of given address.
-h --html Display results as HTML (not finished in this version).
--
1.5.5
-- System Information:
Debian Release: lenny/sid
APT prefers unstable
APT policy: (500, 'unstable')
Architecture: i386 (i686)
Kernel: Linux 2.6.22-2-686 (SMP w/1 CPU core)
Locale: LANG=en_DK.UTF-8, LC_CTYPE=en_DK.UTF-8 (charmap=ISO-8859-1) (ignored:
LC_ALL set to en_US.iso88591)
Shell: /bin/sh linked to /bin/dash
Versions of packages ipcalc depends on:
ii perl 5.8.8-12 Larry Wall's Practical Extraction
ipcalc recommends no packages.
-- no debconf information
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]