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

Function decode_switches

src/ls.c:1907–2455  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1905 Return the index of the first non-option argument. */
1906
1907static int
1908decode_switches (int argc, char **argv)
1909{
1910 char *time_style_option = NULL;
1911
1912 /* These variables are false or -1 unless a switch says otherwise. */
1913 bool kibibytes_specified = false;
1914 int format_opt = -1;
1915 int hide_control_chars_opt = -1;
1916 int quoting_style_opt = -1;
1917 int sort_opt = -1;
1918 ptrdiff_t tabsize_opt = -1;
1919 ptrdiff_t width_opt = -1;
1920
1921 while (true)
1922 {
1923 int oi = -1;
1924 int c = getopt_long (argc, argv,
1925 "abcdfghiklmnopqrstuvw:xABCDFGHI:LNQRST:UXZ1",
1926 long_options, &oi);
1927 if (c == -1)
1928 break;
1929
1930 switch (c)
1931 {
1932 case 'a':
1933 ignore_mode = IGNORE_MINIMAL;
1934 break;
1935
1936 case 'b':
1937 quoting_style_opt = escape_quoting_style;
1938 break;
1939
1940 case 'c':
1941 time_type = time_ctime;
1942 explicit_time = true;
1943 break;
1944
1945 case 'd':
1946 immediate_dirs = true;
1947 break;
1948
1949 case 'f':
1950 ignore_mode = IGNORE_MINIMAL; /* enable -a */
1951 sort_opt = sort_none; /* enable -U */
1952 break;
1953
1954 case FILE_TYPE_INDICATOR_OPTION: /* --file-type */
1955 indicator_style = file_type;
1956 break;
1957
1958 case 'g':
1959 format_opt = long_format;
1960 print_owner = false;
1961 break;
1962
1963 case 'h':
1964 file_human_output_opts = human_output_opts =

Callers 1

mainFunction · 0.70

Calls 7

decode_line_lengthFunction · 0.85
add_ignore_patternFunction · 0.85
stdout_isattyFunction · 0.85
x_timestyle_matchFunction · 0.85
abformat_initFunction · 0.85
usageFunction · 0.70
getenv_quoting_styleFunction · 0.70

Tested by

no test coverage detected