/etc/profile ignored; other strangeness

Chuck Bogorad chuck@ethereal.ru
Tue Jan 27 22:14:00 GMT 1998

>3) As you can see above, the hostname of my system is printed in all caps
>some reason. I placed in my /etc/profile the following line:
>export HOSTNAME=`/NT/system32/hostname`
>which works fine on the command line and returns a lower-case version of my
>hostname. (The cygwin32 version of hostname returns the hostname in all
>don't know why.) Bash is supposed to use $HOSTNAME for the \h in $PS1.
>what is going on here?

bash uses "gethostname()" if it is avaliable, or it's own version (in
oslib.c). you
can delete line "#define HAVE_GETHOSTNAME 1" in config.h and hack this
to downcase name.

#if !defined (HAVE_GETHOSTNAME)
#  if defined (HAVE_UNAME)
#    include <sys/utsname.h>
gethostname (name, namelen)
     char *name;
     int namelen;
  int i;
  struct utsname ut;
  uname (&ut);
  i = strlen (ut.nodename) + 1;
  strncpy (name, ut.nodename, i < namelen ? i : namelen);
  name[namelen] = '\0';
  return (0);
#  else /* !HAVE_UNAME */
gethostname (name, namelen)
     int name, namelen;
  strncpy (name, "unknown", namelen);
  name[namelen] = '\0';
  return 0;
#  endif /* !HAVE_UNAME */
#endif /* !HAVE_GETHOSTNAME */

For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".

More information about the Cygwin mailing list