diff options
author | Reid Spencer <rspencer@reidspencer.com> | 2005-01-01 22:29:26 +0000 |
---|---|---|
committer | Reid Spencer <rspencer@reidspencer.com> | 2005-01-01 22:29:26 +0000 |
commit | a01aade75df50eb00c5d0be03594757f9abb3709 (patch) | |
tree | ac8fedb23f7c8f355b710c0015062d6122d456b3 /lib/System/Unix | |
parent | 7109ce8258800f6136a556e0a076c22b432948d4 (diff) | |
download | external_llvm-a01aade75df50eb00c5d0be03594757f9abb3709.zip external_llvm-a01aade75df50eb00c5d0be03594757f9abb3709.tar.gz external_llvm-a01aade75df50eb00c5d0be03594757f9abb3709.tar.bz2 |
Add functions for determining if the stdin/out/err is connected to a
console or not.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19233 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/System/Unix')
-rw-r--r-- | lib/System/Unix/Process.cpp | 24 | ||||
-rw-r--r-- | lib/System/Unix/Process.inc | 24 |
2 files changed, 48 insertions, 0 deletions
diff --git a/lib/System/Unix/Process.cpp b/lib/System/Unix/Process.cpp index c1448de..cccd3ff 100644 --- a/lib/System/Unix/Process.cpp +++ b/lib/System/Unix/Process.cpp @@ -122,5 +122,29 @@ void Process::PreventCoreFiles() { #endif } +bool Process::StandardInIsUserInput() { +#if HAVE_ISATTY + return isatty(0); +#endif + // If we don't have isatty, just return false. + return false; +} + +bool Process::StandardOutIsDisplayed() { +#if HAVE_ISATTY + return isatty(1); +#endif + // If we don't have isatty, just return false. + return false; +} + +bool Process::StandardErrIsDisplayed() { +#if HAVE_ISATTY + return isatty(2); +#endif + // If we don't have isatty, just return false. + return false; +} + } // vim: sw=2 smartindent smarttab tw=80 autoindent expandtab diff --git a/lib/System/Unix/Process.inc b/lib/System/Unix/Process.inc index c1448de..cccd3ff 100644 --- a/lib/System/Unix/Process.inc +++ b/lib/System/Unix/Process.inc @@ -122,5 +122,29 @@ void Process::PreventCoreFiles() { #endif } +bool Process::StandardInIsUserInput() { +#if HAVE_ISATTY + return isatty(0); +#endif + // If we don't have isatty, just return false. + return false; +} + +bool Process::StandardOutIsDisplayed() { +#if HAVE_ISATTY + return isatty(1); +#endif + // If we don't have isatty, just return false. + return false; +} + +bool Process::StandardErrIsDisplayed() { +#if HAVE_ISATTY + return isatty(2); +#endif + // If we don't have isatty, just return false. + return false; +} + } // vim: sw=2 smartindent smarttab tw=80 autoindent expandtab |