2
0

gethostname.c 308 B

123456789101112131415
  1. #include <stdlib.h>
  2. #include <stdio.h>
  3. #include <unistd.h>
  4. #include "test_helpers.h"
  5. int main(void) {
  6. char hostname[256] = { 0 };
  7. int status = gethostname(hostname, 256);
  8. ERROR_IF(gethostname, status, == -1);
  9. UNEXP_IF(gethostname, status, != 0);
  10. printf("Hostname: %s\n", hostname);
  11. }