brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.0 KiB · 8f378de Raw
62 lines · cpp
1// RUN: %clangxx -O0 -g %s -o %t2 3// Android doesn't have ttyent.h.4// UNSUPPORTED: android5 6#include <assert.h>7#include <stdlib.h>8#include <ttyent.h>9 10#include <assert.h>11#include <stdlib.h>12#include <ttyent.h>13 14void test1() {15  struct ttyent *typ = getttyent();16  assert(typ && typ->ty_name != nullptr);17  assert(typ->ty_type != nullptr);18  endttyent();19}20 21void test2() {22  struct ttyent *typ = getttynam("console");23  assert(typ && typ->ty_name != nullptr);24  assert(typ->ty_type != nullptr);25  endttyent();26}27 28void test3() {29  if (!setttyent())30    exit(1);31 32  struct ttyent *typ = getttyent();33  assert(typ && typ->ty_name != nullptr);34  assert(typ->ty_type != nullptr);35  endttyent();36}37 38#if defined(__NetBSD__)39void test4() {40  if (!setttyentpath(_PATH_TTYS))41    exit(1);42 43  struct ttyent *typ = getttyent();44  assert(typ && typ->ty_name != nullptr);45  assert(typ->ty_type != nullptr);46  assert(typ->ty_class != nullptr);47 48  endttyent();49}50#endif51 52int main(void) {53  test1();54  test2();55  test3();56#if defined(__NetBSD__)57  test4();58#endif59 60  return 0;61}62