diff options
author | Bill Nottingham <notting@redhat.com> | 2009-03-17 15:14:26 -0400 |
---|---|---|
committer | Bill Nottingham <notting@redhat.com> | 2009-03-17 15:14:26 -0400 |
commit | 30558c7a855058994a520c74af77db0854fc296d (patch) | |
tree | bf4071b6148108c18036640e9f2e917af87c750e | |
parent | a0895aba2529c34387cf9abdc658f5f43c39d32c (diff) | |
download | initscripts-30558c7a855058994a520c74af77db0854fc296d.tar initscripts-30558c7a855058994a520c74af77db0854fc296d.tar.gz initscripts-30558c7a855058994a520c74af77db0854fc296d.tar.bz2 initscripts-30558c7a855058994a520c74af77db0854fc296d.tar.xz initscripts-30558c7a855058994a520c74af77db0854fc296d.zip |
Add an option for consoletype to always return 0.
This allows tcsh -e to work, with lang.sh. It's a hack, but there really
isn't a better way to solve it.
-rwxr-xr-x | lang.csh | 2 | ||||
-rwxr-xr-x | lang.sh | 2 | ||||
-rw-r--r-- | src/consoletype.1 | 9 | ||||
-rw-r--r-- | src/consoletype.c | 2 |
4 files changed, 10 insertions, 5 deletions
@@ -26,7 +26,7 @@ if ($sourced == 1) then endif endif - set consoletype=`/sbin/consoletype` + set consoletype=`/sbin/consoletype stdout` if ($?LANG) then switch ($LANG) @@ -42,7 +42,7 @@ if [ "$sourced" = 1 ]; then consoletype=$CONSOLETYPE if [ -z "$consoletype" ]; then - consoletype=$(/sbin/consoletype || :) + consoletype=$(/sbin/consoletype stdout) fi if [ -n "$LANG" ]; then diff --git a/src/consoletype.1 b/src/consoletype.1 index 3f4ec14b..ebd1d88c 100644 --- a/src/consoletype.1 +++ b/src/consoletype.1 @@ -3,7 +3,7 @@ \fBconsoletype \- print type of the console connected to standard input .SH SYNOPSIS -\fBconsoletype [\fIfg\fR] +\fBconsoletype [\fIstdout\fR] [\fIfg\fR] .SH DESCRIPTION \fBconsoletype prints the type of console connected to standard input, and checks @@ -29,6 +29,11 @@ if on serial console \fI2 if on a pseudo terminal. .TP +When passed the \fIstdout\fR argument, \fBconsoletype\fR returns +.TP +\fI0 +in all cases, and prints the console type to stdout. +.TP When passed the \fIfg\fR argument, \fBconsoletype\fR returns .TP \fI0 @@ -36,4 +41,4 @@ if the console connected to standard input is the current virtual terminal .TP \fI1 -otherwise.
\ No newline at end of file +otherwise. diff --git a/src/consoletype.c b/src/consoletype.c index 82d3f6ab..211869ce 100644 --- a/src/consoletype.c +++ b/src/consoletype.c @@ -67,6 +67,6 @@ int main(int argc, char **argv) return 0; } else { printf("%s\n",type); - return ret; + return (argc > 1 && !strcmp(argv[1],"stdout")) ? 0 : ret; } } |