brintos

brintos / llvm-project-archived public Read only

0
0
Text · 544 B · f805f31 Raw
27 lines · cpp
1// RUN: %clangxx -O0 -g %s -o %t -lutil && %run %t 2>&1 | FileCheck %s2 3#include <assert.h>4#include <stdio.h>5#include <stdlib.h>6#include <libutil.h>7 8int main(void) {9  printf("fparseln\n");10 11  FILE *fp = fopen("/etc/fstab", "r");12  assert(fp);13 14  int flags = FPARSELN_UNESCALL;15  const char *delim = "\\\\#";16  size_t lineno = 0, len;17  char *line;18  while ((line = fparseln(fp, &len, &lineno, delim, flags))) {19    printf("lineno: %zu, length: %zu, line: %s\n", lineno, len, line);20    free(line);21  }22 23  // CHECK: fparseln24 25  return 0;26}27