brintos

brintos / llvm-project-archived public Read only

0
0
Text · 588 B · 5f0968e Raw
32 lines · cpp
1// RUN: %clangxx -O0 -g %s -o %t && %run %t 2>&1 | FileCheck %s2// UNSUPPORTED: target={{.*(linux|solaris).*}}3 4#include <sys/cdefs.h>5#include <sys/stat.h>6 7#include <assert.h>8#include <stdio.h>9#include <stdlib.h>10 11int main(void) {12  struct stat st;13  char name[100];14  mode_t type;15 16  assert(!stat("/dev/null", &st));17 18  type = S_ISCHR(st.st_mode) ? S_IFCHR : S_IFBLK;19 20#if defined(__NetBSD__)21  assert(!devname_r(st.st_rdev, type, name, sizeof(name)));22#else23  assert(devname_r(st.st_rdev, type, name, sizeof(name)));24#endif25 26  printf("%s\n", name);27 28  // CHECK: null29 30  return 0;31}32