Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:24:19

0001 /*-
0002  * Copyright (c) 1989, 1993
0003  *  The Regents of the University of California.  All rights reserved.
0004  *
0005  * This code is derived from software contributed to Berkeley by
0006  * Michael Fischbein.
0007  *
0008  * Redistribution and use in source and binary forms, with or without
0009  * modification, are permitted provided that the following conditions
0010  * are met:
0011  * 1. Redistributions of source code must retain the above copyright
0012  *    notice, this list of conditions and the following disclaimer.
0013  * 2. Redistributions in binary form must reproduce the above copyright
0014  *    notice, this list of conditions and the following disclaimer in the
0015  *    documentation and/or other materials provided with the distribution.
0016  * 4. Neither the name of the University nor the names of its contributors
0017  *    may be used to endorse or promote products derived from this software
0018  *    without specific prior written permission.
0019  *
0020  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
0021  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
0022  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
0023  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
0024  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
0025  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
0026  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
0027  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
0028  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
0029  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
0030  * SUCH DAMAGE.
0031  *
0032  *  from: @(#)ls.h  8.1 (Berkeley) 5/31/93
0033  * $FreeBSD: src/bin/ls/ls.h,v 1.23 2008/04/04 03:57:46 grog Exp $
0034  */
0035 
0036 #ifndef _EXTERN_LS_H_
0037 #define _EXTERN_LS_H_
0038 
0039 #define NO_PRINT    1
0040 //#define COLORLS   1
0041 
0042 #include <sys/cdefs.h>
0043 #include <setjmp.h>
0044 #include <rtems.h>
0045 
0046 #define major(d) rtems_filesystem_dev_major_t(d)
0047 #define minor(d) rtems_filesystem_dev_minor_t(d)
0048 
0049 const char *user_from_uid(uid_t uid, int nouser);
0050 
0051 typedef struct {
0052   int blocksize;
0053   int termwidth;
0054   int sortkey;
0055   int rval;
0056   int output;
0057   time_t now;
0058 
0059   int f_accesstime;
0060   int f_column;
0061   int f_columnacross;
0062   int f_flags;
0063   int f_grouponly;
0064   int f_humanize;
0065   int f_inode;
0066   int f_listdir;
0067   int f_listdot;
0068   int f_longform;
0069   int f_nonprint;
0070   int f_nosort;
0071   int f_numericonly;
0072   int f_octal;
0073   int f_octal_escape;
0074   int f_recursive;
0075   int f_reversesort;
0076   int f_sectime;
0077   int f_singlecol;
0078   int f_size;
0079   int f_statustime;
0080   int f_stream;
0081   int f_type;
0082   int f_typedir;
0083   int f_whiteout;
0084 
0085   int exit_code;
0086   jmp_buf exit_jmp;
0087 } rtems_shell_ls_globals;
0088 
0089 #define blocksize      globals->blocksize
0090 #define termwidth      globals->termwidth
0091 #define sortkey        globals->sortkey
0092 #define rval           globals->rval
0093 #define output         globals->output
0094 #define now            globals->now
0095 
0096 #define f_accesstime   globals->f_accesstime
0097 #define f_column       globals->f_column
0098 #define f_columnacross globals->f_columnacross
0099 #define f_flags        globals->f_flags
0100 #define f_grouponly    globals->f_grouponly
0101 #define f_humanize     globals->f_humanize
0102 #define f_inode        globals->f_inode
0103 #define f_listdir      globals->f_listdir
0104 #define f_listdot      globals->f_listdot
0105 #define f_longform     globals->f_longform
0106 #define f_nonprint     globals->f_nonprint
0107 #define f_nosort       globals->f_nosort
0108 #define f_numericonly  globals->f_numericonly
0109 #define f_octal        globals->f_octal
0110 #define f_octal_escape globals->f_octal_escape
0111 #define f_recursive    globals->f_recursive
0112 #define f_reversesort  globals->f_reversesort
0113 #define f_sectime      globals->f_sectime
0114 #define f_singlecol    globals->f_singlecol
0115 #define f_size         globals->f_size
0116 #define f_statustime   globals->f_statustime
0117 #define f_stream       globals->f_stream
0118 #define f_type         globals->f_type
0119 #define f_typedir      globals->f_typedir
0120 #define f_whiteout     globals->f_whiteout
0121 
0122 #define exit_jump      &(globals->exit_jmp)
0123 
0124 void rtems_shell_ls_exit(rtems_shell_ls_globals* globals, int code);
0125 
0126 #define exit(ec) rtems_shell_ls_exit(globals, ec)
0127 
0128 
0129 typedef struct {
0130         FTSENT *list;
0131         u_int64_t btotal;
0132         u_int64_t stotal;
0133         int entries;
0134         int maxlen;
0135         int s_block;
0136         int s_flags;
0137         int s_group;
0138         int s_inode;
0139         int s_nlink;
0140         int s_size;
0141         int s_user;
0142         int s_major;
0143         int s_minor;
0144 } DISPLAY;
0145 
0146 typedef struct {
0147         char *user;
0148         char *group;
0149         char *flags;
0150         char data[1];
0151 } NAMES;
0152 
0153 #define acccmp        rtems_shell_ls_acccmp
0154 #define revacccmp     rtems_shell_ls_revacccmp
0155 #define modcmp        rtems_shell_ls_modcmp
0156 #define revmodcmp     rtems_shell_ls_revmodcmp
0157 #define namecmp       rtems_shell_ls_namecmp
0158 #define revnamecmp    rtems_shell_ls_revnamecmp
0159 #define statcmp       rtems_shell_ls_statcmp
0160 #define revstatcmp    rtems_shell_ls_revstatcmp
0161 #define sizecmp       rtems_shell_ls_sizecmp
0162 #define revsizecmp    rtems_shell_ls_revsizecmp
0163 #define printescaped  rtems_shell_ls_printescaped
0164 #define printacol     rtems_shell_ls_printacol
0165 #define printcol      rtems_shell_ls_printcol
0166 #define printlong     rtems_shell_ls_printlong
0167 #define printscol     rtems_shell_ls_printscol
0168 #define printstream   rtems_shell_ls_printstream
0169 #define usage         rtems_shell_ls_usage
0170 
0171 int      acccmp(const FTSENT *, const FTSENT *);
0172 int      revacccmp(const FTSENT *, const FTSENT *);
0173 int      modcmp(const FTSENT *, const FTSENT *);
0174 int      revmodcmp(const FTSENT *, const FTSENT *);
0175 int      namecmp(const FTSENT *, const FTSENT *);
0176 int      revnamecmp(const FTSENT *, const FTSENT *);
0177 int      statcmp(const FTSENT *, const FTSENT *);
0178 int      revstatcmp(const FTSENT *, const FTSENT *);
0179 int      sizecmp(const FTSENT *, const FTSENT *);
0180 int      revsizecmp(const FTSENT *, const FTSENT *);
0181 
0182 int      printescaped(rtems_shell_ls_globals* globals, const char *);
0183 void     printacol(rtems_shell_ls_globals* globals, DISPLAY *);
0184 void     printcol(rtems_shell_ls_globals* globals, DISPLAY *);
0185 void     printlong(rtems_shell_ls_globals* globals, DISPLAY *);
0186 void     printscol(rtems_shell_ls_globals* globals, DISPLAY *);
0187 void     printstream(rtems_shell_ls_globals* globals, DISPLAY *);
0188 int      safe_print(rtems_shell_ls_globals* globals, const char *);
0189 void     usage(rtems_shell_ls_globals* globals);
0190 
0191 void strmode(mode_t mode, char *p);
0192 
0193 #endif /* !_EXTERN_H_ */