fix block/unblock, ascii/ebcdic, cbs relationships (extensive)
[unix-history] / usr / src / bin / dd / dd.h
CommitLineData
d5cadd14
KB
1/*-
2 * Copyright (c) 1991 The Regents of the University of California.
3 * All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
a08a4cd0
KB
6 * Keith Muller of the University of California, San Diego and Lance
7 * Visser of Convex Computer Corporation.
d5cadd14
KB
8 *
9 * %sccs.include.redist.c%
10 *
998e1ac9 11 * @(#)dd.h 5.3 (Berkeley) %G%
d5cadd14
KB
12 */
13
14/* Input/output stream state. */
998e1ac9 15typedef struct {
d5cadd14
KB
16 u_char *db; /* buffer address */
17 u_char *dbp; /* current buffer I/O address */
18 u_long dbcnt; /* current buffer byte count */
19 int dbrcnt; /* last read byte count */
20 u_long dbsz; /* buffer size */
21
22#define ISCHR 0x01 /* character device (warn on short) */
23#define ISPIPE 0x02 /* pipe (not truncatable) */
24#define ISTAPE 0x04 /* tape (not seekable) */
25#define NOREAD 0x08 /* not readable */
26 u_int flags;
27
28 char *name; /* name */
29 int fd; /* file descriptor */
30 u_long offset; /* # of blocks to skip */
31
32 u_long f_stats; /* # of full blocks processed */
33 u_long p_stats; /* # of partial blocks processed */
998e1ac9 34 u_long s_stats; /* # of odd swab blocks */
d5cadd14 35 u_long t_stats; /* # of truncations */
998e1ac9
KB
36} IO;
37
38typedef struct {
39 u_long in_full; /* # of full input blocks */
40 u_long in_part; /* # of partial input blocks */
41 u_long out_full; /* # of full output blocks */
42 u_long out_part; /* # of partial output blocks */
43 u_long trunc; /* # of truncated records */
44 u_long swab; /* # of odd-length swab blocks */
45} STAT;
d5cadd14
KB
46
47/* Flags (in ddflags). */
998e1ac9
KB
48#define C_ASCII 0x00001
49#define C_BLOCK 0x00002
50#define C_BS 0x00004
51#define C_CBS 0x00008
52#define C_COUNT 0x00010
53#define C_EBCDIC 0x00020
54#define C_FILES 0x00040
55#define C_IBS 0x00080
56#define C_IF 0x00100
57#define C_LCASE 0x00200
58#define C_NOERROR 0x00400
59#define C_NOTRUNC 0x00800
60#define C_OBS 0x01000
61#define C_OF 0x02000
62#define C_SEEK 0x04000
63#define C_SKIP 0x08000
64#define C_SWAB 0x10000
65#define C_SYNC 0x20000
66#define C_UCASE 0x40000
67#define C_UNBLOCK 0x80000