File indexing completed on 2025-05-11 08:24:19
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037 #include <wchar.h>
0038
0039 typedef struct _pr {
0040 struct _pr *nextpr;
0041 #define F_ADDRESS 0x001
0042 #define F_BPAD 0x002
0043 #define F_C 0x004
0044 #define F_CHAR 0x008
0045 #define F_DBL 0x010
0046 #define F_INT 0x020
0047 #define F_P 0x040
0048 #define F_STR 0x080
0049 #define F_U 0x100
0050 #define F_UINT 0x200
0051 #define F_TEXT 0x400
0052 u_int flags;
0053 int bcnt;
0054 char *cchar;
0055 char *fmt;
0056 char *nospace;
0057 int mbleft;
0058 mbstate_t mbstate;
0059 } PR;
0060
0061 typedef struct _fu {
0062 struct _fu *nextfu;
0063 struct _pr *nextpr;
0064 #define F_IGNORE 0x01
0065 #define F_SETREP 0x02
0066 u_int flags;
0067 int reps;
0068 int bcnt;
0069 char *fmt;
0070 } FU;
0071
0072 typedef struct _fs {
0073 struct _fs *nextfs;
0074 struct _fu *nextfu;
0075 int bcnt;
0076 } FS;
0077
0078 #if 0
0079 extern FS *fshead;
0080 extern FU *endfu;
0081 extern int blocksize;
0082 extern int exitval;
0083 extern int odmode;
0084 extern int length;
0085 extern off_t skip;
0086 enum _vflag { ALL, DUP, FIRST, WAIT };
0087 extern enum _vflag vflag;
0088 #endif
0089
0090 #include <setjmp.h>
0091 #include <stdio.h>
0092
0093 enum _vflag { ALL, DUP, FIRST, WAIT };
0094 typedef struct rtems_shell_hexdump_globals_t {
0095 FS *fshead;
0096 FU *endfu;
0097 int blocksize;
0098 int exitval;
0099 int odmode;
0100 int length;
0101 off_t skip;
0102 enum _vflag vflag;
0103
0104 off_t address;
0105 off_t eaddress;
0106 int ateof;
0107 u_char *curp;
0108 u_char *savp;
0109 int done;
0110
0111 FILE* hdstdin;
0112
0113 int exit_code;
0114 jmp_buf exit_jmp;
0115 } rtems_shell_hexdump_globals;
0116
0117 #define fshead globals->fshead
0118 #define endfu globals->endfu
0119 #define blocksize globals->blocksize
0120 #define exitval globals->exitval
0121 #define odmode globals->odmode
0122 #define length globals->length
0123 #define skip globals->skip
0124 #define vflag globals->vflag
0125
0126 #define address globals->address
0127 #define eaddress globals->eaddress
0128 #define ateof globals->ateof
0129 #define curp globals->curp
0130 #define savp globals->savp
0131 #define done globals->done
0132
0133 #define hdstdin globals->hdstdin
0134
0135 #define exit_jump &(globals->exit_jmp)
0136
0137 #define add rtems_shell_hexdump_add
0138 #define addfile rtems_shell_hexdump_addfile
0139 #define badcnt rtems_shell_hexdump_badcnt
0140 #define badconv rtems_shell_hexdump_badconv
0141 #define badfmt rtems_shell_hexdump_badfmt
0142 #define badsfmt rtems_shell_hexdump_badsfmt
0143 #define bpad rtems_shell_hexdump_bpad
0144 #define conv_c rtems_shell_hexdump_conv_c
0145 #define conv_u rtems_shell_hexdump_conv_u
0146 #define display rtems_shell_hexdump_display
0147 #define doskip rtems_shell_hexdump_doskip
0148 #define escape rtems_shell_hexdump_escape
0149 #define get rtems_shell_hexdump_get
0150 #define newsyntax rtems_shell_hexdump_newsyntax
0151 #define next rtems_shell_hexdump_next
0152 #define nomem rtems_shell_hexdump_nomem
0153 #define oldsyntax rtems_shell_hexdump_oldsyntax
0154 #define peek rtems_shell_hexdump_peek
0155 #define rewrite rtems_shell_hexdump_rewrite
0156 #define size rtems_shell_hexdump_size
0157 #define usage rtems_shell_hexdump_usage
0158
0159 void add(rtems_shell_hexdump_globals*, const char *);
0160 void addfile(rtems_shell_hexdump_globals*, char *);
0161 void badcnt(rtems_shell_hexdump_globals*, char *);
0162 void badconv(rtems_shell_hexdump_globals*, char *);
0163 void badfmt(rtems_shell_hexdump_globals*, const char *);
0164 void badsfmt(rtems_shell_hexdump_globals*);
0165 void bpad(PR *);
0166 void conv_c(rtems_shell_hexdump_globals*, PR *, u_char *, size_t);
0167 void conv_u(rtems_shell_hexdump_globals*, PR *, u_char *);
0168 void display(rtems_shell_hexdump_globals*);
0169 void doskip(rtems_shell_hexdump_globals*, const char *, int);
0170 void escape(char *);
0171 u_char *get(rtems_shell_hexdump_globals*);
0172 void newsyntax(rtems_shell_hexdump_globals*, int, char ***);
0173 int next(rtems_shell_hexdump_globals*, char **);
0174 void nomem(void);
0175 void oldsyntax(rtems_shell_hexdump_globals*, int, char ***);
0176 size_t peek(rtems_shell_hexdump_globals*, u_char *, size_t);
0177 void rewrite(rtems_shell_hexdump_globals*, FS *);
0178 int size(rtems_shell_hexdump_globals*, FS *);
0179 void usage(rtems_shell_hexdump_globals*);
0180
0181 #define exit(ec) rtems_shell_hexdump_exit(globals, ec)
0182
0183 void rtems_shell_hexdump_exit(rtems_shell_hexdump_globals* globals, int code);