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

Function get_columns

ccan/ccan/opt/usage.c:23–43  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

21#define MIN_TOTAL_WIDTH 50
22
23static unsigned int get_columns(void)
24{
25 int ws_col = 0;
26 const char *env = getenv("COLUMNS");
27
28 if (env)
29 ws_col = atoi(env);
30
31#ifdef TIOCGWINSZ
32 if (!ws_col)
33 {
34 struct winsize w;
35 if (ioctl(0, TIOCGWINSZ, &w) != -1)
36 ws_col = w.ws_col;
37 }
38#endif
39 if (!ws_col)
40 ws_col = 80;
41
42 return ws_col;
43}
44
45/* Return number of chars of words to put on this line.
46 * 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