MCPcopy Create free account
hub / github.com/ElementsProject/lightning / get_columns

Function get_columns

ccan/ccan/opt/usage.c:26–46  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

24#define OPT_SHOW_LEN 80
25
26static unsigned int get_columns(void)
27{
28 int ws_col = 0;
29 const char *env = getenv("COLUMNS");
30
31 if (env)
32 ws_col = atoi(env);
33
34#ifdef TIOCGWINSZ
35 if (!ws_col)
36 {
37 struct winsize w;
38 if (ioctl(0, TIOCGWINSZ, &w) != -1)
39 ws_col = w.ws_col;
40 }
41#endif
42 if (!ws_col)
43 ws_col = 80;
44
45 return ws_col;
46}
47
48/* Return number of chars of words to put on this line.
49 * Prefix is set to number to skip at start, maxlen is max width, returns

Callers 1

opt_usageFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected