1 /* `dir', `vdir' and `ls' directory listing programs for GNU.
3 Modified by Chet Ramey for Readline.
5 Copyright (C) 1985, 1988, 1990-1991, 1995-2010, 2012, 2015
6 Free Software Foundation, Inc.
8 This program is free software: you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation, either version 3 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>. */
21 /* Written by Richard Stallman and David MacKenzie. */
23 /* Color support by Peter Anvin <Peter.Anvin@linux.org> and Dennis
24 Flaherty <dennisf@denix.elk.miles.com> based on original patches by
25 Greg Lee <lee@uhunix.uhcc.hawaii.edu>. */
30 #include <stdio.h> // size_t
32 #if defined(__TANDEM) && defined(HAVE_STDBOOL_H) && (__STDC_VERSION__ < 199901L)
36 #if defined (HAVE_STDBOOL_H)
37 # include <stdbool.h> // bool
39 typedef int _rl_bool_t
;
44 #define bool _rl_bool_t
51 #endif /* !HAVE_STDBOOL_H */
53 /* Null is a valid character in a color indicator (think about Epson
54 printers, for example) so we have to use a length/buffer string
62 /* file type indicators (dir, sock, fifo, ...)
63 Default value is initialized in parse-colors.c.
64 It is then modified from the values of $LS_COLORS. */
65 extern struct bin_str _rl_color_indicator
[];
67 /* The LS_COLORS variable is in a termcap-like format. */
68 typedef struct _color_ext_type
70 struct bin_str ext
; /* The extension we're looking for */
71 struct bin_str seq
; /* The sequence to output when we do */
72 struct _color_ext_type
*next
; /* Next in list */
75 /* file extensions indicators (.txt, .log, .jpg, ...)
76 Values are taken from $LS_COLORS in rl_parse_colors(). */
77 extern COLOR_EXT_TYPE
*_rl_color_ext_list
;
79 #define FILETYPE_INDICATORS \
81 C_ORPHAN, C_FIFO, C_CHR, C_DIR, C_BLK, C_FILE, \
82 C_LINK, C_SOCK, C_FILE, C_DIR \
85 /* Whether we used any colors in the output so far. If so, we will
86 need to restore the default color later. If not, we will need to
87 call prep_non_filename_text before using color for the first time. */
91 C_LEFT
, C_RIGHT
, C_END
, C_RESET
, C_NORM
, C_FILE
, C_DIR
, C_LINK
,
93 C_BLK
, C_CHR
, C_MISSING
, C_ORPHAN
, C_EXEC
, C_DOOR
, C_SETUID
, C_SETGID
,
94 C_STICKY
, C_OTHER_WRITABLE
, C_STICKY_OTHER_WRITABLE
, C_CAP
, C_MULTIHARDLINK
,
100 # define S_IXUGO (S_IXUSR | S_IXGRP | S_IXOTH)
117 /* Prefix color, currently same as socket */
118 #define C_PREFIX C_SOCK
120 extern void _rl_put_indicator (const struct bin_str
*ind
);
121 extern void _rl_set_normal_color (void);
122 extern bool _rl_print_prefix_color (void);
123 extern bool _rl_print_color_indicator (const char *f
);
124 extern void _rl_prep_non_filename_text (void);
126 #endif /* !_COLORS_H_ */