FreeBSD/usr.bin/last/last.c
/*
 * hostconv --
 *	convert the hostname to search pattern; if the supplied host name
 *	has a domain attached that is the same as the current domain, rip
 *	off the domain suffix since that's what login(1) does.
 */
hostconv
convert the hostname to search pattern; if the supplied host name
has a domain attached that is the same as the current domain, rip
off the domain suffix since that's what login(1) does.
hostconv convert the hostname to search pattern ; if the supplied host name has a domain attached that is the same as the current domain rip off the domain suffix since that ' s what login ( 1 ) does .
static void
hostconv(char *arg)
{
	static int first = 1;
	static char *hostdot, name[MAXHOSTNAMELEN];
	char *argdot;
	if (!(argdot = strchr(arg, '.')))
		return;
	if (first) {
		first = 0;
		if (gethostname(name, sizeof(name)))
			err(1, "gethostname");
		hostdot = strchr(name, '.');
	}
	if (hostdot && !strcasecmp(hostdot, argdot))
		*argdot = '\0';
}
static void hostconv ( char * arg ) { static int first = 1 ; static char * hostdot , name [ MAXHOSTNAMELEN ] ; char * argdot ; if ( ! ( argdot = strchr ( arg , ' ' ) ) ) return ; if ( first ) { first = 0 ; if ( gethostname ( name , sizeof ( name ) ) ) err ( 1 , " " ) ; hostdot = strchr ( name , ' ' ) ; } if ( hostdot && ! strcasecmp ( hostdot , argdot ) ) * argdot = ' \0 ' ; }
hostconv
      convert the hostname to search pattern; if the supplied host name
      has a domain attached that is the same as the current domain, rip
      off the domain suffix since that's what login(1) does.
hostconv convert the hostname to search pattern ; if the supplied host name has a domain attached that is the same as the current domain rip off the domain suffix since that ' s what login ( 1 ) does .