This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: /etc/profile ignored; other strangeness


>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@cygnus.com" with one line of text: "help".


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]