source: rtems/cpukit/libmisc/shell/extern-ls.h @ f97536d

5
Last change on this file since f97536d was f97536d, checked in by Sebastian Huber <sebastian.huber@…>, on 10/16/15 at 06:21:48

basdefs.h: Add and use RTEMS_UNUSED

  • Property mode set to 100644
File size: 6.4 KB
Line 
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#include <rtems.h>
45
46#define major(d) rtems_filesystem_dev_major_t(d)
47#define minor(d) rtems_filesystem_dev_minor_t(d)
48
49const char *user_from_uid(uid_t uid, int nouser);
50
51typedef struct {
52  int blocksize;
53  int termwidth;
54  int sortkey;
55  int rval;
56  int output;
57  time_t now;
58
59  int f_accesstime;
60  int f_column;
61  int f_columnacross;
62  int f_flags;
63  int f_grouponly;
64  int f_humanize;
65  int f_inode;
66  int f_listdir;
67  int f_listdot;
68  int f_longform;
69  int f_nonprint;
70  int f_nosort;
71  int f_numericonly;
72  int f_octal;
73  int f_octal_escape;
74  int f_recursive;
75  int f_reversesort;
76  int f_sectime;
77  int f_singlecol;
78  int f_size;
79  int f_statustime;
80  int f_stream;
81  int f_type;
82  int f_typedir;
83  int f_whiteout;
84
85  int exit_code;
86  jmp_buf exit_jmp;
87} rtems_shell_ls_globals;
88
89#define blocksize      globals->blocksize
90#define termwidth      globals->termwidth
91#define sortkey        globals->sortkey
92#define rval           globals->rval
93#define output         globals->output
94#define now            globals->now
95
96#define f_accesstime   globals->f_accesstime
97#define f_column       globals->f_column
98#define f_columnacross globals->f_columnacross
99#define f_flags        globals->f_flags
100#define f_grouponly    globals->f_grouponly
101#define f_humanize     globals->f_humanize
102#define f_inode        globals->f_inode
103#define f_listdir      globals->f_listdir
104#define f_listdot      globals->f_listdot
105#define f_longform     globals->f_longform
106#define f_nonprint     globals->f_nonprint
107#define f_nosort       globals->f_nosort
108#define f_numericonly  globals->f_numericonly
109#define f_octal        globals->f_octal
110#define f_octal_escape globals->f_octal_escape
111#define f_recursive    globals->f_recursive
112#define f_reversesort  globals->f_reversesort
113#define f_sectime      globals->f_sectime
114#define f_singlecol    globals->f_singlecol
115#define f_size         globals->f_size
116#define f_statustime   globals->f_statustime
117#define f_stream       globals->f_stream
118#define f_type         globals->f_type
119#define f_typedir      globals->f_typedir
120#define f_whiteout     globals->f_whiteout
121
122#define exit_jump      &(globals->exit_jmp)
123
124void rtems_shell_ls_exit(rtems_shell_ls_globals* globals, int code);
125
126#define exit(ec) rtems_shell_ls_exit(globals, ec)
127
128
129typedef struct {
130        FTSENT *list;
131        u_int64_t btotal;
132        u_int64_t stotal;
133        int entries;
134        int maxlen;
135        int s_block;
136        int s_flags;
137        int s_group;
138        int s_inode;
139        int s_nlink;
140        int s_size;
141        int s_user;
142        int s_major;
143        int s_minor;
144} DISPLAY;
145
146typedef struct {
147        char *user;
148        char *group;
149        char *flags;
150        char data[1];
151} NAMES;
152
153#define acccmp        rtems_shell_ls_acccmp
154#define revacccmp     rtems_shell_ls_revacccmp
155#define modcmp        rtems_shell_ls_modcmp
156#define revmodcmp     rtems_shell_ls_revmodcmp
157#define namecmp       rtems_shell_ls_namecmp
158#define revnamecmp    rtems_shell_ls_revnamecmp
159#define statcmp       rtems_shell_ls_statcmp
160#define revstatcmp    rtems_shell_ls_revstatcmp
161#define sizecmp       rtems_shell_ls_sizecmp
162#define revsizecmp    rtems_shell_ls_revsizecmp
163#define printescaped  rtems_shell_ls_printescaped
164#define printacol     rtems_shell_ls_printacol
165#define printcol      rtems_shell_ls_printcol
166#define printlong     rtems_shell_ls_printlong
167#define printscol     rtems_shell_ls_printscol
168#define printstream   rtems_shell_ls_printstream
169#define usage         rtems_shell_ls_usage
170
171int      acccmp(const FTSENT *, const FTSENT *);
172int      revacccmp(const FTSENT *, const FTSENT *);
173int      modcmp(const FTSENT *, const FTSENT *);
174int      revmodcmp(const FTSENT *, const FTSENT *);
175int      namecmp(const FTSENT *, const FTSENT *);
176int      revnamecmp(const FTSENT *, const FTSENT *);
177int      statcmp(const FTSENT *, const FTSENT *);
178int      revstatcmp(const FTSENT *, const FTSENT *);
179int      sizecmp(const FTSENT *, const FTSENT *);
180int      revsizecmp(const FTSENT *, const FTSENT *);
181
182int      printescaped(rtems_shell_ls_globals* globals, const char *);
183void     printacol(rtems_shell_ls_globals* globals, DISPLAY *);
184void     printcol(rtems_shell_ls_globals* globals, DISPLAY *);
185void     printlong(rtems_shell_ls_globals* globals, DISPLAY *);
186void     printscol(rtems_shell_ls_globals* globals, DISPLAY *);
187void     printstream(rtems_shell_ls_globals* globals, DISPLAY *);
188int      safe_print(rtems_shell_ls_globals* globals, const char *);
189void     usage(rtems_shell_ls_globals* globals);
190
191void strmode(mode_t mode, char *p);
192
193#endif /* !_EXTERN_H_ */
Note: See TracBrowser for help on using the repository browser.