brintos

brintos / llvm-project-archived public Read only

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