Author Topic: Getting name of handheld  (Read 1996 times)

boosalis

  • Jr. Member
  • **
  • Posts: 78
    • View Profile
    • http://
Getting name of handheld
« 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
Zaurus 6000 with expansion jacket

tumnus

  • Hero Member
  • *****
  • Posts: 1176
    • View Profile
    • http://www.cpinkney.org.uk
Getting name of handheld
« Reply #1 on: July 09, 2004, 05:36:55 pm »
What about using the 'hostname' command?
# Search the Zaurus Howtos ## Search the Zaurus FAQs ## Find Z software at ELSI #
--------------------
UK SL5500 with Sharp ROM 3.13, SL5600 with Sharp ROM 1.32 - SuSE 9.0 Pro, Windows XP Home
Qualendar for Calendar and Todo
Socket Bluetooth CF Card (Rev F), Kingmax 512MB MMC Card, Palm Tungsten T Stylus,
Pretec CF->Smartmedia Adapter, Semsons Universal Battery Extender

boosalis

  • Jr. Member
  • **
  • Posts: 78
    • View Profile
    • http://
Getting name of handheld
« Reply #2 on: July 09, 2004, 07:17:29 pm »
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
Zaurus 6000 with expansion jacket

doseas

  • Full Member
  • ***
  • Posts: 207
    • View Profile
    • http://
Getting name of handheld
« Reply #3 on: July 09, 2004, 08:06:20 pm »
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.