MCPcopy Create free account
hub / github.com/coreutils/coreutils / decode_line_length

Function decode_line_length

src/ls.c:1867–1890  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1865 if unsuccessful. 0 means no limit on line length. */
1866
1867static ptrdiff_t
1868decode_line_length (char const *spec)
1869{
1870 uintmax_t val;
1871
1872 /* Treat too-large values as if they were 0, which is
1873 effectively infinity. */
1874 switch (xstrtoumax (spec, NULL, 0, &val, ""))
1875 {
1876 case LONGINT_OK:
1877 return val <= MIN (PTRDIFF_MAX, SIZE_MAX) ? val : 0;
1878
1879 case LONGINT_OVERFLOW:
1880 return 0;
1881
1882 case LONGINT_INVALID:
1883 case LONGINT_INVALID_SUFFIX_CHAR:
1884 case LONGINT_INVALID_SUFFIX_CHAR_WITH_OVERFLOW:
1885 return -1;
1886
1887 default:
1888 unreachable ();
1889 }
1890}
1891
1892/* Return true if standard output is a tty, caching the result. */
1893

Callers 1

decode_switchesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected