1 | // RUN: %clangxx -O0 -g %s -o %t && %run %t 2>&1 | FileCheck %s |
2 | |
3 | #include <assert.h> |
4 | #include <stdio.h> |
5 | #include <stdlib.h> |
6 | |
7 | int main(void) { |
8 | printf(format: "fparseln\n" ); |
9 | |
10 | FILE *fp = fopen(filename: "/etc/fstab" , modes: "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(format: "lineno: %zu, length: %zu, line: %s\n" , lineno, len, line); |
19 | free(ptr: line); |
20 | } |
21 | |
22 | // CHECK: fparseln |
23 | |
24 | return 0; |
25 | } |
26 | |