Index: /issm/trunk-jpl/src/m/os/oshostname.m
===================================================================
--- /issm/trunk-jpl/src/m/os/oshostname.m	(revision 20442)
+++ /issm/trunk-jpl/src/m/os/oshostname.m	(revision 20443)
@@ -5,9 +5,15 @@
 %      hostname=oshostname();
 
-% Find computer name from environment
-if ispc
-	hostname = getenv('COMPUTERNAME');
-else
-	hostname = getenv('HOSTNAME');
+%See http://www.mathworks.com/help/matlab/ref/system.html "tips" section
+%We need to add < /dev/null otherwise what is in the clipboard is added
+[status,hostname]=system('hostname < /dev/null');
+
+% If that command did not work, we have an alternative
+if status~=0,
+	if ispc
+		hostname = getenv('COMPUTERNAME');
+	else
+		hostname = getenv('HOSTNAME');
+	end
 end
 
@@ -15,4 +21,7 @@
 hostname = strrep(hostname,'-','');
 
+% Trim and lower case
+hostname = strtrim(lower(hostname));
+
 % Check that machine name is not empty
 if isempty(hostname),
