Help - Search - Members - Calendar
Full Version: Getting name of handheld
OESF Forums > General Forums > General Support and Discussion > Software
boosalis
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
tumnus
What about using the 'hostname' command?
boosalis
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
doseas
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.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2014 Invision Power Services, Inc.