diff options
author | schnetter <schnetter@83718e91-0e4f-0410-abf4-91180603181f> | 2008-02-04 19:05:32 +0000 |
---|---|---|
committer | schnetter <schnetter@83718e91-0e4f-0410-abf4-91180603181f> | 2008-02-04 19:05:32 +0000 |
commit | 12b54e8cf8f30366dbde63f12c20464969f16d1b (patch) | |
tree | 49269acacca3a3a5986e3c9cac1885416fe500e0 | |
parent | 788331242f56736b73a2d5319af5d8dd571b1592 (diff) |
Use a user-provided host name from $HOME/.hostname, if this file
exists and is not empty.
git-svn-id: http://svn.cactuscode.org/arrangements/CactusUtils/Formaline/trunk@155 83718e91-0e4f-0410-abf4-91180603181f
-rwxr-xr-x | src/util/gethostname.pl | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/util/gethostname.pl b/src/util/gethostname.pl index 26b09ad..f3e112e 100755 --- a/src/util/gethostname.pl +++ b/src/util/gethostname.pl @@ -12,6 +12,14 @@ use strict; +# Get the user's idea of this system's host name +my $userhostname = `cat ~/.hostname 2> /dev/null`; +chomp $userhostname; +if ($userhostname ne '') { + print "$userhostname\n"; + exit 0; +} + # Get the system's idea of its host name my $hostname = `hostname`; chomp $hostname; |