OILS / cpp / libc.h View on Github | oilshell.org

38 lines, 20 significant
1// libc.h: Replacement for native/libc.c
2
3#ifndef LIBC_H
4#define LIBC_H
5
6#include <stdlib.h>
7
8#include "mycpp/runtime.h"
9
10namespace libc {
11
12// TODO: SHARE with pyext
13inline void print_time(double real, double user, double sys) {
14 fprintf(stderr, "real\t%.3f\n", real);
15 fprintf(stderr, "user\t%.3f\n", user);
16 fprintf(stderr, "sys\t%.3f\n", sys);
17}
18
19BigStr* realpath(BigStr* path);
20
21BigStr* gethostname();
22
23int fnmatch(BigStr* pat, BigStr* str, int flags = 0);
24
25List<BigStr*>* glob(BigStr* pat);
26
27Tuple2<int, int>* regex_first_group_match(BigStr* pattern, BigStr* str,
28 int pos);
29
30List<int>* regex_search(BigStr* pattern, int cflags, BigStr* str, int eflags,
31 int pos = 0);
32
33int wcswidth(BigStr* str);
34int get_terminal_width();
35
36} // namespace libc
37
38#endif // LIBC_H