OESF Portables Forum
Everything Else => General Support and Discussion => Zaurus General Forums => Archived Forums => Software => Topic started by: boosalis on July 09, 2004, 01:30:41 pm
-
I would like to get from the environment variable HOSTNAME the name of the handheld, but it is not set. I can currently hard code it in the zaurus .profile. But is there a better way to do this. I think there is a file in /etc called HOSTNAME, but from what I can gather you can set this value to anything and it never changes any thing.
Thank you for any help
-david
-
What about using the 'hostname' command?
-
I am doing this from source code, Sure I guess I could execute getHostname and have it print to a file then read the file. But I would rather use something like
char *hostname;
hostname = getenv("HOSTNAME");
Which works on linux desktop machines
-David
-
In my /etc/rc.d/rc.local, I added the following line:
# set default hostname
/bin/hostname zaurus
this apparently causes the OS to set the proper value in /etc/HOSTNAME and also the $HOSTNAME env var.