File: fd.h

package info (click to toggle)
fdclone 3.01b-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd, stretch
  • size: 4,772 kB
  • ctags: 8,674
  • sloc: ansic: 100,552; makefile: 4,497; sh: 1,480; sed: 224
file content (438 lines) | stat: -rw-r--r-- 10,642 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
/*
 *	fd.h
 *
 *	definitions for FD
 */

#include "headers.h"

#ifndef	FD
#define	FD			3
#endif
#ifndef	DEFRC
#define	DEFRC			"/etc/fd2rc"
#endif

#if	FD < 2
#define	_NOORIGSHELL
#define	_NOSPLITWIN
#define	_NOPRECEDE
#define	_NOCUSTOMIZE
#define	_NOEXTRACOPY
#define	_NOUSEHASH
#define	_NOORIGGLOB
#define	_NOKANJIFCONV
#define	_NOBROWSE
#define	_NOEXTRAMACRO
#define	_NOTRADLAYOUT
#define	_NOEXTRAWIN
#define	_NOPTY
#define	_NOEXTRAATTR
#define	_NOLOGGING
#define	_NOIME
#endif	/* FD < 2 */

#if	FD < 3
#define	_NOCATALOG
#define	_NODYNAMICLIST
#define	_NOSOCKET
#define	_NOSOCKREDIR
#define	_NOFTP
#define	_NOHTTP
#define	_NOVERSCMP
#endif	/* FD < 3 */

#ifdef	DEBUG
extern VOID mtrace __P_ ((VOID_A));
extern VOID muntrace __P_ ((VOID_A));
extern char *_mtrace_file;
#endif

#if	MSDOS
# ifdef	BSPATHDELIM
#  if	FD >= 2
#  define	FD_RCFILE	"~\\fd2.rc"
#  else
#  define	FD_RCFILE	"~\\fd.rc"
#  endif
# else	/* !BSPATHDELIM */
#  if	FD >= 2
#  define	FD_RCFILE	"~/fd2.rc"
#  else
#  define	FD_RCFILE	"~/fd.rc"
#  endif
# endif	/* !BSPATHDELIM */
#define	TMPPREFIX		"FD"
#define	ARCHTMPPREFIX		"AR"
#define	DOSTMPPREFIX		'D'
#else	/* !MSDOS */
# if	FD >= 2
# define	FD_RCFILE	"~/.fd2rc"
# else
# define	FD_RCFILE	"~/.fdrc"
# endif
#define	TMPPREFIX		"fd"
#define	ARCHTMPPREFIX		"ar"
#define	DOSTMPPREFIX		'd'
#endif	/* !MSDOS */

#if	MSDOS && defined (_NOORIGSHELL)
/*	Using COMMAND.COM */
#define	SHELL_OPERAND		"|"
#define	CMDLINE_DELIM		"\t\n <>|"
#else
#define	SHELL_OPERAND		"&;(`|"
#define	CMDLINE_DELIM		"\t\n &;()<>|"
#endif

#define	FDPROG			"fd"
#define	FDSHELL			"fdsh"
#define	FDENV			"FD_"
#define	FDESIZ			strsize(FDENV)
#define	FDVERSION		"FD_VERSION"

/****************************************************************
 *	If you don't like the following tools as each uses,	*
 *	you should rewrite another suitable command name.	*
 ****************************************************************/
#define	PAGER			"/usr/bin/pager"		/* to view file */
#define	EDITOR			"/usr/bin/editor"		/* to edit file */


/****************************************************************
 *	Default value in case if not defined by neither environ	*
 *	variables nor run_com file nor command line option	*
 ****************************************************************/
#define	BASICCUSTOM		0
#define	SORTTYPE		0
#define	DISPLAYMODE		0
#define	SORTTREE		0
#define	WRITEFS			0
#define	IGNORECASE		0
#define	VERSIONCOMP		0
#define	INHERITCOPY		0
#define	PROGRESSBAR		0
#define	PRECOPYMENU		0
#define	ADJTTY			0
#define	USEGETCURSOR		0
#define	DEFCOLUMNS		2
#define	MINFILENAME		12
#define	WIDEDIGIT		0
#define	SIZEUNIT		0
#if	MSDOS
# ifdef	BSPATHDELIM
# define	HISTFILE	"~\\fd.hst"
# else
# define	HISTFILE	"~/fd.hst"
# endif
#else	/* !MSDOS */
#define	HISTFILE		"~/.fd_history"
#endif	/* !MSDOS */
#define	DIRHISTFILE		""
#define	HISTSIZE		50
#define	DIRHIST			50
#define	SAVEHIST		50
#define	SAVEDIRHIST		50
#define	HISTUMASK		022
#define	DIRHISTUMASK		022
#define	DIRCOUNTLIMIT		50
#define	DOSDRIVE		0
#define	SECOND			0
#define	AUTOUPDATE		0
#define	TRADLAYOUT		0
#define	SIZEINFO		0
#define	FUNCLAYOUT		1005
#define	IMEKEY			-1
#define	IMEBUFFER		0
#define	IMELEARNING		16
#if	MSDOS
# ifdef	BSPATHDELIM
# define	FREQFILE	"~\\fd.frq"
# else
# define	FREQFILE	"~/fd.frq"
# endif
#else	/* !MSDOS */
#define	FREQFILE		"~/.fd_freq"
#endif	/* !MSDOS */
#define	FREQUMASK		022
#define	ANSICOLOR		0
#define	ANSIPALETTE		""
#define	EDITMODE		"emacs"
#define	LOOPCURSOR		0
#if	MSDOS
#define	TMPDIR			"."
#else
#define	TMPDIR			"/tmp"
#endif
#define	TMPUMASK		022
#define	RRPATH			""
#define	PRECEDEPATH		""
#if	FD >= 2
#define	PROMPT			"$ "
#else
#define	PROMPT			"sh#"
#endif
#define	PROMPT2			"> "
#define	DUMBSHELL		0
#define	PTYMODE			0
#define	PTYTERM			"vt100"
#define	PTYMENUKEY		-1
#define	LOGFILE			""
#define	LOGSIZE			1024
#define	USESYSLOG		0
#define	LOGLEVEL		0
#define	ROOTLOGLEVEL		1
#define	THRUARGS		0
#define	URLDRIVE		0
#define	URLTIMEOUT		0
#define	URLOPTIONS		0
#define	HIDEPASSWD		0
#define	FTPADDRESS		"FDclone@"
#define	FTPPROXY		""
#define	FTPLOGFILE		""
#define	HTTPPROXY		""
#define	HTTPLOGFILE		""
#define	HTMLLOGFILE		""
#define	UNICODEBUFFER		0
#define	SJISPATH		""
#define	EUCPATH			""
#define	JISPATH			""
#define	JIS8PATH		""
#define	JUNETPATH		""
#define	OJISPATH		""
#define	OJIS8PATH		""
#define	OJUNETPATH		""
#define	HEXPATH			""
#define	CAPPATH			""
#define	UTF8PATH		""
#define	UTF8MACPATH		""
#define	UTF8ICONVPATH		""
#define	NOCONVPATH		""


/****************************************************************
 *	Maximum value of some arrays (to change in compile)	*
 ****************************************************************/
#define	MAXBINDTABLE		256
#define	MAXMACROTABLE		64
#define	MAXLAUNCHTABLE		32
#define	MAXARCHIVETABLE		16
#define	MAXALIASTABLE		256
#define	MAXFUNCTABLE		32
#define	MAXFUNCLINES		16
#if	MSDOS
#define	MAXCOMMSTR		(128 - 2)
#endif
#define	MAXSELECTSTRS		16
#define	MAXSTACK		5
#ifdef	_NOEXTRAWIN
#define	MAXWINDOWS		2
#else
#define	MAXWINDOWS		5
#endif
#define	MAXHISTNO		MAXTYPE(short)
#define	MAXINVOKEARGS		MAXWINDOWS
#define	MAXLOGLEN		255

#include "depend.h"
#ifndef	__FD_PRIMAL__
#include "printf.h"
#include "kctype.h"
#include "string.h"
#include "malloc.h"
#endif


/****************************************************************
 *	Screen layout parameter					*
 ****************************************************************/
#define	FILEPERLINE		(curcolumns)
#ifdef	_NOSPLITWIN
#define	fileperrow(w)		(n_line - wheader - WFOOTER)
#else
#define	fileperrow(w)		((n_line - wheader - WFOOTER + 1) / (w) - 1)
#endif
#define	FILEPERPAGE		(FILEPERLINE * FILEPERROW)

#ifdef	_NOTRADLAYOUT
#define	istradlayout()		(0)
#define	hassizeinfo()		(sizeinfo)
#else
#define	istradlayout()		(tradlayout && n_column >= WCOLUMNSTD)
#define	hassizeinfo()		(sizeinfo || istradlayout())
#endif
#define	WHEADERMIN		3
#define	WHEADERMAX		4
#define	WHEADER			(WHEADERMIN + ((hassizeinfo()) ? 1 : 0))
#define	WFOOTER			3
#define	L_TITLE			0
#define	L_SIZE			1
#define	L_STATUS		(sizeinfo + 1)
#define	L_PATH			(sizeinfo + 2)
#define	TL_SIZE			1
#define	TL_STATUS		3
#define	TL_PATH			2
#ifdef	HAVEFLAGS
#define	WMODELINE		2
#else
#define	WMODELINE		1
#endif
#define	WFILEMINTREE		3
#define	WFILEMINCUSTOM		4
#define	WFILEMINATTR		(WMODELINE + 5)
#define	WFILEMIN		1
#if	FD >= 2
#define	MAXHELPINDEX		20
#define	MAXSORTINHERIT		2
#else
#define	MAXHELPINDEX		10
#define	MAXSORTINHERIT		1
#endif
#define	MAXSORTTYPE		5
#define	L_STACK			(n_line - 3)
#define	L_HELP			(n_line - 2)
#define	L_INFO			(n_line - 1)
#define	L_CMDLINE		(n_line - 2)
#define	WCMDLINE		2
#define	L_MESLINE		(n_line - 1)
#define	WCOLUMNSTD		80
#define	WCOLUMNOMIT		58
#define	WCOLUMNHARD		42
#define	WCOLUMNMIN		34
#define	S_BYTES			" bytes"
#define	W_BYTES			strsize(S_BYTES)
#define	S_PAGE			"Page:"
#define	S_MARK			"Mark:"
#define	S_INFO			""
#define	S_SORT			"Sort:"
#define	S_FIND			"Find:"
#define	S_PATH			"Path:"
#define	S_BROWSE		"Browse:"
#define	S_ARCH			"Arch:"
#define	S_SIZE			"Size:"
#define	S_TOTAL			"Total:"
#define	S_USED			""
#define	S_FREE			"Free:"
#define	TS_PAGE			"Page:"
#define	TS_MARK			"Marked"
#define	TS_INFO			"Info:"
#define	TS_SORT			""
#define	TS_FIND			""
#define	TS_PATH			"Path="
#define	TS_BROWSE		"Browse="
#define	TS_ARCH			"Arch="
#define	TS_SIZE			"Files "
#define	TS_TOTAL		"Total:"
#define	TS_USED			"Used:"
#define	TS_FREE			"Free:"
#define	W_PAGE			strsize(S_PAGE)
#define	W_MARK			strsize(S_MARK)
#define	W_INFO			strsize(S_INFO)
#define	W_SORT			strsize(S_SORT)
#define	W_FIND			strsize(S_FIND)
#define	W_PATH			strsize(S_PATH)
#define	W_BROWSE		strsize(S_BROWSE)
#define	W_ARCH			strsize(S_ARCH)
#define	W_SIZE			strsize(S_SIZE)
#define	W_TOTAL			strsize(S_TOTAL)
#define	W_USED			strsize(S_USED)
#define	W_FREE			strsize(S_FREE)
#define	TW_PAGE			strsize(TS_PAGE)
#define	TW_MARK			strsize(TS_MARK)
#define	TW_INFO			strsize(TS_INFO)
#define	TW_SORT			strsize(TS_SORT)
#define	TW_FIND			strsize(TS_FIND)
#define	TW_PATH			strsize(TS_PATH)
#define	TW_BROWSE		strsize(TS_BROWSE)
#define	TW_ARCH			strsize(TS_ARCH)
#define	TW_SIZE			strsize(TS_SIZE)
#define	TW_TOTAL		strsize(TS_TOTAL)
#define	TW_USED			strsize(TS_USED)
#define	TW_FREE			strsize(TS_FREE)
#if	FD >= 3
#define	D_PAGE			(widedigit ? 4 : 2)
#define	D_MARK			(widedigit ? 5 : 4)
#else
#define	D_PAGE			2
#define	D_MARK			4
#endif
#define	D_INFO			0
#define	D_SORT			14
#define	D_FIND			(n_column - C_FIND - W_FIND)
#define	D_PATH			(n_column - C_PATH - W_PATH)
#define	D_BROWSE		(n_column - C_PATH - W_BROWSE)
#define	D_ARCH			(n_column - C_PATH - W_ARCH)
#define	D_SIZE			14
#define	D_TOTAL			15
#define	D_USED			0
#define	D_FREE			15
#if	FD >= 3
#define	TW_GAP			(widedigit ? 1 : 3)
#define	TD_PAGE			(widedigit ? 4 : 2)
#define	TD_MARK			(widedigit ? 5 : 4)
#else
#define	TW_GAP			3
#define	TD_PAGE			2
#define	TD_MARK			4
#endif
#define	TD_INFO			(TC_SIZE - TC_INFO - TW_INFO)
#define	TD_SORT			0
#define	TD_FIND			0
#define	TD_PATH			(TC_MARK - TC_PATH - TW_PATH)
#define	TD_BROWSE		(TC_MARK - TC_PATH - TW_BROWSE)
#define	TD_ARCH			(TC_MARK - TC_PATH - TW_ARCH)
#define	TD_SIZE			13
#define	TD_TOTAL		14
#define	TD_USED			13
#define	TD_FREE			14
#define	C_PAGE			((isleftshift()) ? 0 : 1)
#define	C_MARK			(C_PAGE + W_PAGE + D_PAGE + 1 + D_PAGE + 1)
#define	C_INFO			-1
#define	C_SORT			(C_MARK + W_MARK + D_MARK + 1 + D_MARK + 1)
#define	C_FIND			(C_SORT + \
				((ishardomit()) ? 0 : W_SORT + D_SORT + 1))
#define	C_PATH			((isleftshift()) ? 0 : 1)
#define	C_SIZE			((isleftshift()) ? 0 : 1)
#define	C_TOTAL			(C_SIZE + W_SIZE + D_SIZE + 1 + D_SIZE + 2)
#define	C_USED			-1
#define	C_FREE			(C_TOTAL + W_TOTAL + D_TOTAL + 1)
#define	TC_PAGE			2
#define	TC_MARK			(n_column - TD_MARK - TW_MARK - TD_SIZE - 2)
#define	TC_INFO			2
#define	TC_SORT			-1
#define	TC_FIND			-1
#define	TC_PATH			2
#define	TC_SIZE			(n_column - TD_MARK - TW_SIZE - TD_SIZE - 2)
#define	TC_TOTAL		(TC_PAGE + TW_PAGE + TD_PAGE + 1 + TD_PAGE \
				+ TW_GAP)
#define	TC_USED			(TC_TOTAL + TW_TOTAL + TD_TOTAL + TW_GAP)
#define	TC_FREE			(TC_USED + TW_USED + TD_USED + TW_GAP)

#define	WSIZE			9
#define	WSIZE2			8
#define	TWSIZE2			10
#define	WDATE			8
#define	WTIME			5
#define	WSECOND			2
#if	MSDOS
#define	WMODE			5
#else
#define	WMODE			10
#endif
#define	TWMODE			9
#define	WNLINK			2
#ifndef	NOUID
#define	WOWNER			8
#define	WGROUP			8
#define	WOWNERMIN		5
#define	WGROUPMIN		5
#endif


/****************************************************************
 *	Restrictions for causation				*
 ****************************************************************/
#ifdef	UNKNOWNFS
#undef	WRITEFS
#define	WRITEFS			2
#endif