File: util.c

package info (click to toggle)
mrtgutils 0.5
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k, sarge
  • size: 80 kB
  • ctags: 34
  • sloc: ansic: 327; makefile: 73
file content (17 lines) | stat: -rw-r--r-- 311 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include "util.h"
#include <stdio.h>
#include <unistd.h>
#include <netdb.h>
#include <string.h>
#include <ctype.h>

void print_hostname(void)
{
  char hostname[255];
  struct hostent *h;

  gethostname(hostname, sizeof(hostname));
  h = gethostbyname(hostname);
  printf("%s\n", (h ? h->h_name : "(none)"));
}