diff options
author | Jim Meyering <jim@meyering.net> | 1998-12-12 06:11:24 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 1998-12-12 06:11:24 +0000 |
commit | 876d24a3ed258106602660cbe76ac896ee91a328 (patch) | |
tree | 83e793d8931f548ff3bbb7254210360b3e0195a9 /src | |
parent | 1384f07f77d237869653282b804540f80e37f2b4 (diff) | |
download | coreutils-876d24a3ed258106602660cbe76ac896ee91a328.tar.xz |
* src/ls.c: Group DIRED's code together.
(full_time, inhibit_group, col_ext_type): Declare static.
(dired_dump_obstack): Apply sizeof to variable, instead of its type.
(parse_ls_color): Rename ext2 as e2. Move into the block where it is used.
From Akim Demaille.
Diffstat (limited to 'src')
-rw-r--r-- | src/ls.c | 94 |
1 files changed, 47 insertions, 47 deletions
@@ -284,7 +284,7 @@ static enum time_type time_type; /* print the full time, otherwise the standard unix heuristics. */ -int full_time; +static int full_time; /* The file characteristic to sort by. Controlled by -t, -S, -U, -X, -v. */ @@ -310,7 +310,7 @@ static int sort_reverse; /* Nonzero means to NOT display group information. -G */ -int inhibit_group; +static int inhibit_group; /* Nonzero means print the user and group id's as numbers rather than as names. -n */ @@ -404,7 +404,7 @@ static struct bin_str color_indicator[] = }; /* FIXME: comment */ -struct col_ext_type *col_ext_list = NULL; +static struct col_ext_type *col_ext_list = NULL; /* Buffer for color sequences */ static char *color_buf; @@ -566,6 +566,46 @@ static char const *const time_args[] = "atime", "access", "use", "ctime", "status", 0 }; +static enum time_type const time_types[] = +{ + time_atime, time_atime, time_atime, time_ctime, time_ctime +}; + +static char const *const color_args[] = + { + /* Note: "no" is a prefix of "none" so we don't include it. */ + /* force and none are for compatibility with another color-ls version */ + "always", "yes", "force", + "never", "none", + "auto", "tty", "if-tty", 0 + }; + +static enum color_type const color_types[] = + { + color_always, color_always, color_always, + color_never, color_never, + color_if_tty, color_if_tty, color_if_tty + }; + +/* Information about filling a column. */ +struct col_info +{ + int valid_len; + int line_len; + int *col_arr; +}; + +/* Array with information about column filledness. */ +static struct col_info *col_info; + +/* Maximum number of columns ever possible for this display. */ +static int max_idx; + +/* The minimum width of a colum is 3: 1 character for the name and 2 + for the separating white space. */ +#define MIN_COLUMN_WIDTH 3 + + /* This zero-based index is used solely with the --dired option. When that option is in effect, this counter is incremented for each character of output generated by this program so that the beginning @@ -612,46 +652,6 @@ static struct obstack subdired_obstack; } \ while (0) -static enum time_type const time_types[] = -{ - time_atime, time_atime, time_atime, time_ctime, time_ctime -}; - -static char const *const color_args[] = - { - /* Note: "no" is a prefix of "none" so we don't include it. */ - /* force and none are for compatibility with another color-ls version */ - "always", "yes", "force", - "never", "none", - "auto", "tty", "if-tty", 0 - }; - -static enum color_type const color_types[] = - { - color_always, color_always, color_always, - color_never, color_never, - color_if_tty, color_if_tty, color_if_tty - }; - - -/* Information about filling a column. */ -struct col_info -{ - int valid_len; - int line_len; - int *col_arr; -}; - -/* Array with information about column filledness. */ -static struct col_info *col_info; - -/* Maximum number of columns ever possible for this display. */ -static int max_idx; - -/* The minimum width of a colum is 3: 1 character for the name and 2 - for the separating white space. */ -#define MIN_COLUMN_WIDTH 3 - /* Write to standard output PREFIX, followed by the quoting style and a space-separated list of the integers stored in OS all on one line. */ @@ -661,7 +661,7 @@ dired_dump_obstack (const char *prefix, struct obstack *os) { int n_pos; - n_pos = obstack_object_size (os) / sizeof (size_t); + n_pos = obstack_object_size (os) / sizeof (dired_pos); if (n_pos > 0) { int i; @@ -1412,7 +1412,6 @@ parse_ls_color (void) int ind_no; /* Indicator number */ char label[3]; /* Indicator label */ struct col_ext_type *ext; /* Extension we are working on */ - struct col_ext_type *ext2; /* Extra pointer */ if ((p = getenv ("LS_COLORS")) == NULL || *p == '\0') return; @@ -1512,15 +1511,16 @@ parse_ls_color (void) if (state < 0) { struct col_ext_type *e; + struct col_ext_type *e2; error (0, 0, _("unparsable value for LS_COLORS environment variable")); free (color_buf); for (e = col_ext_list; e != NULL ; /* empty */) { - ext2 = e; + e2 = e; e = e->next; - free (ext2); + free (e2); } print_with_color = 0; } |