lgethostname as a function instead of a macro