aboutsummaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
authorschnetter <schnetter@83718e91-0e4f-0410-abf4-91180603181f>2006-05-04 16:26:41 +0000
committerschnetter <schnetter@83718e91-0e4f-0410-abf4-91180603181f>2006-05-04 16:26:41 +0000
commit1c7e5345e2ce8e66d9ef191ad2f2e587734b50a5 (patch)
treea318b9d37737b7c0efe019efb768d328d471af99 /src/util
parentcc2ee658d8cc0352da45788eb2fce0315e1cd49a (diff)
Use Perl instead of C for makeblob and makemetablob.
Begin coupling Formaline to thorn Announce. Create stamp files that record which build and which simulation was run in the output directory. Begin implementing talking to an RDF server. Determine the host name in Perl, which is more reliable. (It is complicated to find a good host name.) git-svn-id: http://svn.cactuscode.org/arrangements/CactusUtils/Formaline/trunk@75 83718e91-0e4f-0410-abf4-91180603181f
Diffstat (limited to 'src/util')
-rwxr-xr-xsrc/util/gethostname.pl38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/util/gethostname.pl b/src/util/gethostname.pl
new file mode 100755
index 0000000..d403e05
--- /dev/null
+++ b/src/util/gethostname.pl
@@ -0,0 +1,38 @@
+#! /usr/bin/perl -w
+
+# Find the host name of this machine
+
+# 2006-05-02 Erik Schnetter <schnetter@cct.lsu.edu>
+
+# Search through the host name and all aliases.
+# Use the first name that contains dots, indicating that this name is
+# a long host name that includes a domain name.
+# If there is no name that includes a domain name, use whatever the
+# system calls "host name".
+
+use strict;
+
+# Get the system's idea of its host name
+my $hostname = `hostname`;
+chomp $hostname;
+
+# Find its host name and all aliases
+my ($name, $aliases, $addrtype, $length, @addrs) = gethostbyname ($hostname);
+
+# Split the aliases
+my @names = ($name, split (' ', $aliases));
+
+# Use the host name as fallback
+my $goodname = $name;
+
+# Search for a name that contains a dot
+foreach my $maybename (@names)
+{
+ if ($maybename =~ /[.]/)
+ {
+ $goodname = $maybename;
+ last;
+ }
+}
+
+print "$goodname\n";