Fri Mar 4 02:46:19 2016 UTC ()
use "static"


(dholland)
diff -r1.22 -r1.23 src/usr.bin/hexdump/display.c
diff -r1.13 -r1.14 src/usr.bin/hexdump/hexdump.h

cvs diff -r1.22 -r1.23 src/usr.bin/hexdump/display.c (expand / switch to unified diff)

--- src/usr.bin/hexdump/display.c 2013/10/18 20:19:03 1.22
+++ src/usr.bin/hexdump/display.c 2016/03/04 02:46:19 1.23
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: display.c,v 1.22 2013/10/18 20:19:03 christos Exp $ */ 1/* $NetBSD: display.c,v 1.23 2016/03/04 02:46:19 dholland Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1989, 1993 4 * Copyright (c) 1989, 1993
5 * The Regents of the University of California. All rights reserved. 5 * The Regents of the University of California. All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -28,50 +28,51 @@ @@ -28,50 +28,51 @@
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * SUCH DAMAGE. 29 * SUCH DAMAGE.
30 */ 30 */
31 31
32#if HAVE_NBTOOL_CONFIG_H 32#if HAVE_NBTOOL_CONFIG_H
33#include "nbtool_config.h" 33#include "nbtool_config.h"
34#endif 34#endif
35 35
36#include <sys/cdefs.h> 36#include <sys/cdefs.h>
37#if !defined(lint) 37#if !defined(lint)
38#if 0 38#if 0
39static char sccsid[] = "@(#)display.c 8.1 (Berkeley) 6/6/93"; 39static char sccsid[] = "@(#)display.c 8.1 (Berkeley) 6/6/93";
40#else 40#else
41__RCSID("$NetBSD: display.c,v 1.22 2013/10/18 20:19:03 christos Exp $"); 41__RCSID("$NetBSD: display.c,v 1.23 2016/03/04 02:46:19 dholland Exp $");
42#endif 42#endif
43#endif /* not lint */ 43#endif /* not lint */
44 44
45#include <sys/param.h> 45#include <sys/param.h>
46#include <sys/stat.h> 46#include <sys/stat.h>
47 47
48#include <ctype.h> 48#include <ctype.h>
49#include <err.h> 49#include <err.h>
50#include <errno.h> 50#include <errno.h>
51#include <inttypes.h> 51#include <inttypes.h>
52#include <stdio.h> 52#include <stdio.h>
53#include <stdlib.h> 53#include <stdlib.h>
54#include <string.h> 54#include <string.h>
55#include <unistd.h> 55#include <unistd.h>
56#include <util.h> 56#include <util.h>
57 57
58#include "hexdump.h" 58#include "hexdump.h"
59 59
60enum _vflag vflag = FIRST; 60enum _vflag vflag = FIRST;
61 61
62static off_t address; /* address/offset in stream */ 62static off_t address; /* address/offset in stream */
63static off_t eaddress; /* end address */ 63static off_t eaddress; /* end address */
64 64
 65static u_char *get(void);
65static inline void print(PR *, u_char *); 66static inline void print(PR *, u_char *);
66 67
67void 68void
68display(void) 69display(void)
69{ 70{
70 FS *fs; 71 FS *fs;
71 FU *fu; 72 FU *fu;
72 PR *pr; 73 PR *pr;
73 int cnt; 74 int cnt;
74 u_char *bp; 75 u_char *bp;
75 off_t saveaddress; 76 off_t saveaddress;
76 u_char savech, *savebp; 77 u_char savech, *savebp;
77 78
@@ -219,27 +220,27 @@ bpad(PR *pr) @@ -219,27 +220,27 @@ bpad(PR *pr)
219 * Remove all conversion flags; '-' is the only one valid 220 * Remove all conversion flags; '-' is the only one valid
220 * with %s, and it's not useful here. 221 * with %s, and it's not useful here.
221 */ 222 */
222 pr->flags = F_BPAD; 223 pr->flags = F_BPAD;
223 pr->cchar[0] = 's'; 224 pr->cchar[0] = 's';
224 pr->cchar[1] = '\0'; 225 pr->cchar[1] = '\0';
225 for (p1 = pr->fmt; *p1 != '%'; ++p1); 226 for (p1 = pr->fmt; *p1 != '%'; ++p1);
226 for (p2 = ++p1; *p1 && strchr(spec, *p1); ++p1); 227 for (p2 = ++p1; *p1 && strchr(spec, *p1); ++p1);
227 while ((*p2++ = *p1++) != '\0'); 228 while ((*p2++ = *p1++) != '\0');
228} 229}
229 230
230static char **_argv; 231static char **_argv;
231 232
232u_char * 233static u_char *
233get(void) 234get(void)
234{ 235{
235 static int ateof = 1; 236 static int ateof = 1;
236 static u_char *curp, *savp; 237 static u_char *curp, *savp;
237 int n; 238 int n;
238 int need, nread; 239 int need, nread;
239 u_char *tmpp; 240 u_char *tmpp;
240 241
241 if (!curp) { 242 if (!curp) {
242 curp = ecalloc(blocksize, 1); 243 curp = ecalloc(blocksize, 1);
243 savp = ecalloc(blocksize, 1); 244 savp = ecalloc(blocksize, 1);
244 } else { 245 } else {
245 tmpp = curp; 246 tmpp = curp;

cvs diff -r1.13 -r1.14 src/usr.bin/hexdump/hexdump.h (expand / switch to unified diff)

--- src/usr.bin/hexdump/hexdump.h 2011/09/04 20:27:27 1.13
+++ src/usr.bin/hexdump/hexdump.h 2016/03/04 02:46:19 1.14
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: hexdump.h,v 1.13 2011/09/04 20:27:27 joerg Exp $ */ 1/* $NetBSD: hexdump.h,v 1.14 2016/03/04 02:46:19 dholland Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1989, 1993 4 * Copyright (c) 1989, 1993
5 * The Regents of the University of California. All rights reserved. 5 * The Regents of the University of California. All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -77,20 +77,19 @@ extern int exitval; /* final exit valu @@ -77,20 +77,19 @@ extern int exitval; /* final exit valu
77extern FS *fshead; /* head of format strings list */ 77extern FS *fshead; /* head of format strings list */
78extern int length; /* max bytes to read */ 78extern int length; /* max bytes to read */
79extern off_t skip; /* bytes to skip */ 79extern off_t skip; /* bytes to skip */
80extern enum _vflag vflag; 80extern enum _vflag vflag;
81 81
82void add(const char *); 82void add(const char *);
83void addfile(char *); 83void addfile(char *);
84void bpad(PR *); 84void bpad(PR *);
85void conv_c(PR *, u_char *); 85void conv_c(PR *, u_char *);
86void conv_u(PR *, u_char *); 86void conv_u(PR *, u_char *);
87void display(void); 87void display(void);
88void doskip(const char *, int); 88void doskip(const char *, int);
89void escape(char *); 89void escape(char *);
90u_char *get(void); 
91void hexsyntax(int, char ***); 90void hexsyntax(int, char ***);
92int next(char **); 91int next(char **);
93void odsyntax(int, char ***); 92void odsyntax(int, char ***);
94void rewrite(FS *); 93void rewrite(FS *);
95int size(FS *); 94int size(FS *);
96void usage(void) __attribute__((__noreturn__)); 95void usage(void) __attribute__((__noreturn__));