RTEMS CPU Kit with SuperCore  4.11.3
extern-ls.h
Go to the documentation of this file.
1 /*-
2  * Copyright (c) 1989, 1993
3  * The Regents of the University of California. All rights reserved.
4  *
5  * This code is derived from software contributed to Berkeley by
6  * Michael Fischbein.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  * 1. Redistributions of source code must retain the above copyright
12  * notice, this list of conditions and the following disclaimer.
13  * 2. Redistributions in binary form must reproduce the above copyright
14  * notice, this list of conditions and the following disclaimer in the
15  * documentation and/or other materials provided with the distribution.
16  * 4. Neither the name of the University nor the names of its contributors
17  * may be used to endorse or promote products derived from this software
18  * without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23  * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30  * SUCH DAMAGE.
31  *
32  * from: @(#)ls.h 8.1 (Berkeley) 5/31/93
33  * $FreeBSD: src/bin/ls/ls.h,v 1.23 2008/04/04 03:57:46 grog Exp $
34  */
35 
36 #ifndef _EXTERN_LS_H_
37 #define _EXTERN_LS_H_
38 
39 #define NO_PRINT 1
40 //#define COLORLS 1
41 
42 #include <sys/cdefs.h>
43 #include <setjmp.h>
44 
45 #define major(d) rtems_filesystem_dev_major_t(d)
46 #define minor(d) rtems_filesystem_dev_minor_t(d)
47 
48 const char *user_from_uid(uid_t uid, int nouser);
49 
50 typedef struct {
51  int blocksize;
52  int termwidth;
53  int sortkey;
54  int rval;
55  int output;
56  time_t now;
57 
58  int f_accesstime;
59  int f_column;
60  int f_columnacross;
61  int f_flags;
62  int f_grouponly;
63  int f_humanize;
64  int f_inode;
65  int f_listdir;
66  int f_listdot;
67  int f_longform;
68  int f_nonprint;
69  int f_nosort;
70  int f_numericonly;
71  int f_octal;
72  int f_octal_escape;
73  int f_recursive;
74  int f_reversesort;
75  int f_sectime;
76  int f_singlecol;
77  int f_size;
78  int f_statustime;
79  int f_stream;
80  int f_type;
81  int f_typedir;
82  int f_whiteout;
83 
84  int exit_code;
85  jmp_buf exit_jmp;
87 
88 #define blocksize globals->blocksize
89 #define termwidth globals->termwidth
90 #define sortkey globals->sortkey
91 #define rval globals->rval
92 #define output globals->output
93 #define now globals->now
94 
95 #define f_accesstime globals->f_accesstime
96 #define f_column globals->f_column
97 #define f_columnacross globals->f_columnacross
98 #define f_flags globals->f_flags
99 #define f_grouponly globals->f_grouponly
100 #define f_humanize globals->f_humanize
101 #define f_inode globals->f_inode
102 #define f_listdir globals->f_listdir
103 #define f_listdot globals->f_listdot
104 #define f_longform globals->f_longform
105 #define f_nonprint globals->f_nonprint
106 #define f_nosort globals->f_nosort
107 #define f_numericonly globals->f_numericonly
108 #define f_octal globals->f_octal
109 #define f_octal_escape globals->f_octal_escape
110 #define f_recursive globals->f_recursive
111 #define f_reversesort globals->f_reversesort
112 #define f_sectime globals->f_sectime
113 #define f_singlecol globals->f_singlecol
114 #define f_size globals->f_size
115 #define f_statustime globals->f_statustime
116 #define f_stream globals->f_stream
117 #define f_type globals->f_type
118 #define f_typedir globals->f_typedir
119 #define f_whiteout globals->f_whiteout
120 
121 #define exit_jump &(globals->exit_jmp)
122 
123 void rtems_shell_ls_exit(rtems_shell_ls_globals* globals, int code);
124 
125 #define exit(ec) rtems_shell_ls_exit(globals, ec)
126 
127 
128 typedef struct {
129  FTSENT *list;
130  u_int64_t btotal;
131  u_int64_t stotal;
132  int entries;
133  int maxlen;
134  int s_block;
135  int s_flags;
136  int s_group;
137  int s_inode;
138  int s_nlink;
139  int s_size;
140  int s_user;
141  int s_major;
142  int s_minor;
143 } DISPLAY;
144 
145 typedef struct {
146  char *user;
147  char *group;
148  char *flags;
149  char data[1];
150 } NAMES;
151 
152 #define acccmp rtems_shell_ls_acccmp
153 #define revacccmp rtems_shell_ls_revacccmp
154 #define modcmp rtems_shell_ls_modcmp
155 #define revmodcmp rtems_shell_ls_revmodcmp
156 #define namecmp rtems_shell_ls_namecmp
157 #define revnamecmp rtems_shell_ls_revnamecmp
158 #define statcmp rtems_shell_ls_statcmp
159 #define revstatcmp rtems_shell_ls_revstatcmp
160 #define sizecmp rtems_shell_ls_sizecmp
161 #define revsizecmp rtems_shell_ls_revsizecmp
162 #define printescaped rtems_shell_ls_printescaped
163 #define printacol rtems_shell_ls_printacol
164 #define printcol rtems_shell_ls_printcol
165 #define printlong rtems_shell_ls_printlong
166 #define printscol rtems_shell_ls_printscol
167 #define printstream rtems_shell_ls_printstream
168 #define usage rtems_shell_ls_usage
169 
170 int acccmp(const FTSENT *, const FTSENT *);
171 int revacccmp(const FTSENT *, const FTSENT *);
172 int modcmp(const FTSENT *, const FTSENT *);
173 int revmodcmp(const FTSENT *, const FTSENT *);
174 int namecmp(const FTSENT *, const FTSENT *);
175 int revnamecmp(const FTSENT *, const FTSENT *);
176 int statcmp(const FTSENT *, const FTSENT *);
177 int revstatcmp(const FTSENT *, const FTSENT *);
178 int sizecmp(const FTSENT *, const FTSENT *);
179 int revsizecmp(const FTSENT *, const FTSENT *);
180 
181 int printescaped(rtems_shell_ls_globals* globals, const char *);
182 void printacol(rtems_shell_ls_globals* globals, DISPLAY *);
183 void printcol(rtems_shell_ls_globals* globals, DISPLAY *);
184 void printlong(rtems_shell_ls_globals* globals, DISPLAY *);
185 void printscol(rtems_shell_ls_globals* globals, DISPLAY *);
186 void printstream(rtems_shell_ls_globals* globals, DISPLAY *);
187 int safe_print(rtems_shell_ls_globals* globals, const char *);
188 void usage(rtems_shell_ls_globals* globals);
189 
190 void strmode(mode_t mode, char *p);
191 
192 #endif /* !_EXTERN_H_ */
Definition: extern-ls.h:51
Definition: extern-ls.h:146
Definition: inftrees.h:25
Definition: fts.h:75
Definition: extern-ls.h:129