Deleted Added
full compact
args.c (51335) args.c (54245)
1/*-
2 * Copyright (c) 1991, 1993, 1994
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Keith Muller of the University of California, San Diego and Lance
7 * Visser of Convex Computer Corporation.
8 *

--- 26 unchanged lines hidden (view full) ---

35 * SUCH DAMAGE.
36 */
37
38#ifndef lint
39#if 0
40static char sccsid[] = "@(#)args.c 8.3 (Berkeley) 4/2/94";
41#endif
42static const char rcsid[] =
1/*-
2 * Copyright (c) 1991, 1993, 1994
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Keith Muller of the University of California, San Diego and Lance
7 * Visser of Convex Computer Corporation.
8 *

--- 26 unchanged lines hidden (view full) ---

35 * SUCH DAMAGE.
36 */
37
38#ifndef lint
39#if 0
40static char sccsid[] = "@(#)args.c 8.3 (Berkeley) 4/2/94";
41#endif
42static const char rcsid[] =
43 "$FreeBSD: head/bin/dd/args.c 51335 1999-09-16 19:50:59Z green $";
43 "$FreeBSD: head/bin/dd/args.c 54245 1999-12-07 03:32:37Z green $";
44#endif /* not lint */
45
46#include <sys/types.h>
47
48#include <err.h>
49#include <errno.h>
50#include <limits.h>
51#include <stdlib.h>

--- 14 unchanged lines hidden (view full) ---

66static void f_obs __P((char *));
67static void f_of __P((char *));
68static void f_seek __P((char *));
69static void f_skip __P((char *));
70static quad_t get_num __P((char *));
71static off_t get_offset __P((char *));
72
73static const struct arg {
44#endif /* not lint */
45
46#include <sys/types.h>
47
48#include <err.h>
49#include <errno.h>
50#include <limits.h>
51#include <stdlib.h>

--- 14 unchanged lines hidden (view full) ---

66static void f_obs __P((char *));
67static void f_of __P((char *));
68static void f_seek __P((char *));
69static void f_skip __P((char *));
70static quad_t get_num __P((char *));
71static off_t get_offset __P((char *));
72
73static const struct arg {
74 char *name;
74 const char *name;
75 void (*f) __P((char *));
76 u_int set, noset;
77} args[] = {
78 { "bs", f_bs, C_BS, C_BS|C_IBS|C_OBS|C_OSYNC },
79 { "cbs", f_cbs, C_CBS, C_CBS },
80 { "conv", f_conv, 0, 0 },
81 { "count", f_count, C_COUNT, C_COUNT },
82 { "files", f_files, C_FILES, C_FILES },

--- 85 unchanged lines hidden (view full) ---

168 if (in.offset > QUAD_MAX / in.dbsz || out.offset > QUAD_MAX / out.dbsz)
169 errx(1, "seek offsets cannot be larger than %qd", QUAD_MAX);
170}
171
172static int
173c_arg(a, b)
174 const void *a, *b;
175{
75 void (*f) __P((char *));
76 u_int set, noset;
77} args[] = {
78 { "bs", f_bs, C_BS, C_BS|C_IBS|C_OBS|C_OSYNC },
79 { "cbs", f_cbs, C_CBS, C_CBS },
80 { "conv", f_conv, 0, 0 },
81 { "count", f_count, C_COUNT, C_COUNT },
82 { "files", f_files, C_FILES, C_FILES },

--- 85 unchanged lines hidden (view full) ---

168 if (in.offset > QUAD_MAX / in.dbsz || out.offset > QUAD_MAX / out.dbsz)
169 errx(1, "seek offsets cannot be larger than %qd", QUAD_MAX);
170}
171
172static int
173c_arg(a, b)
174 const void *a, *b;
175{
176 typedef const struct arg *c_arg_p;
176
177
177 return (strcmp(((struct arg *)a)->name, ((struct arg *)b)->name));
178 return (strcmp(((c_arg_p)a)->name, ((c_arg_p)b)->name));
178}
179
180static void
181f_bs(arg)
182 char *arg;
183{
184 quad_t res;
185

--- 93 unchanged lines hidden (view full) ---

279f_skip(arg)
280 char *arg;
281{
282
283 in.offset = get_offset(arg);
284}
285
286static const struct conv {
179}
180
181static void
182f_bs(arg)
183 char *arg;
184{
185 quad_t res;
186

--- 93 unchanged lines hidden (view full) ---

280f_skip(arg)
281 char *arg;
282{
283
284 in.offset = get_offset(arg);
285}
286
287static const struct conv {
287 char *name;
288 const char *name;
288 u_int set, noset;
289 const u_char *ctab;
290} clist[] = {
291 { "ascii", C_ASCII, C_EBCDIC, e2a_POSIX },
292 { "block", C_BLOCK, C_UNBLOCK, NULL },
293 { "ebcdic", C_EBCDIC, C_ASCII, a2e_POSIX },
294 { "ibm", C_EBCDIC, C_ASCII, a2ibm_POSIX },
295 { "lcase", C_LCASE, C_UCASE, NULL },

--- 29 unchanged lines hidden (view full) ---

325 ctab = cp->ctab;
326 }
327}
328
329static int
330c_conv(a, b)
331 const void *a, *b;
332{
289 u_int set, noset;
290 const u_char *ctab;
291} clist[] = {
292 { "ascii", C_ASCII, C_EBCDIC, e2a_POSIX },
293 { "block", C_BLOCK, C_UNBLOCK, NULL },
294 { "ebcdic", C_EBCDIC, C_ASCII, a2e_POSIX },
295 { "ibm", C_EBCDIC, C_ASCII, a2ibm_POSIX },
296 { "lcase", C_LCASE, C_UCASE, NULL },

--- 29 unchanged lines hidden (view full) ---

326 ctab = cp->ctab;
327 }
328}
329
330static int
331c_conv(a, b)
332 const void *a, *b;
333{
334 typedef const struct conv *c_conv_p;
333
335
334 return (strcmp(((struct conv *)a)->name, ((struct conv *)b)->name));
336 return (strcmp(((c_conv_p)a)->name, ((c_conv_p)b)->name));
335}
336
337/*
338 * Convert an expression of the following forms to a quad_t.
339 * 1) A positive decimal number.
340 * 2) A positive decimal number followed by a b (mult by 512.)
341 * 3) A positive decimal number followed by a k (mult by 1 << 10.)
342 * 4) A positive decimal number followed by a m (mult by 1 << 20.)

--- 87 unchanged lines hidden ---
337}
338
339/*
340 * Convert an expression of the following forms to a quad_t.
341 * 1) A positive decimal number.
342 * 2) A positive decimal number followed by a b (mult by 512.)
343 * 3) A positive decimal number followed by a k (mult by 1 << 10.)
344 * 4) A positive decimal number followed by a m (mult by 1 << 20.)

--- 87 unchanged lines hidden ---