delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1998/01/27/23:06:07

From: chuck AT ethereal DOT ru (Chuck Bogorad)
Subject: Re: /etc/profile ignored; other strangeness
27 Jan 1998 23:06:07 -0800 :
Message-ID: <01bd2bb3$dad5ffc0$0100a8c0.cygnus.gnu-win32@hysteria.spb.ru>
Mime-Version: 1.0
To: "Tim Fisher" <tfisher AT teamparadigm DOT com>,
"gnu-win32" <gnu-win32 AT cygnus DOT com>

>3) As you can see above, the hostname of my system is printed in all caps
for
>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
caps--I
>don't know why.) Bash is supposed to use $HOSTNAME for the \h in $PS1.
Again,
>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
function
to downcase name.

#if !defined (HAVE_GETHOSTNAME)
#  if defined (HAVE_UNAME)
#    include <sys/utsname.h>
int
gethostname (name, namelen)
     char *name;
     int namelen;
{
  int i;
  struct utsname ut;
  --namelen;
  uname (&ut);
  i = strlen (ut.nodename) + 1;
  strncpy (name, ut.nodename, i < namelen ? i : namelen);
  name[namelen] = '\0';
  return (0);
}
#  else /* !HAVE_UNAME */
int
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 AT cygnus DOT com" with one line of text: "help".

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019