mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-12-20 15:26:43 +01:00
WARNS=2 fixups.
This commit is contained in:
parent
dc2e599970
commit
c38cc7439c
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=87203
@ -3,6 +3,7 @@
|
||||
|
||||
PROG= hexdump
|
||||
SRCS= conv.c display.c hexdump.c hexsyntax.c odsyntax.c parse.c
|
||||
WARNS?= 2
|
||||
MAN= hexdump.1 od.1
|
||||
MLINKS= hexdump.1 hd.1
|
||||
LINKS= ${BINDIR}/hexdump ${BINDIR}/od
|
||||
|
@ -29,10 +29,12 @@
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char sccsid[] = "@(#)conv.c 8.1 (Berkeley) 6/6/93";
|
||||
static const char sccsid[] = "@(#)conv.c 8.1 (Berkeley) 6/6/93";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -48,36 +50,44 @@ conv_c(pr, p)
|
||||
{
|
||||
extern int deprecated;
|
||||
char buf[10], *str;
|
||||
static char nul[] = "\\0";
|
||||
static char alarm[] = "\\a";
|
||||
static char backspace[] = "\\b";
|
||||
static char formfeed[] = "\\f";
|
||||
static char newline[] = "\\n";
|
||||
static char carriageret[] = "\\r";
|
||||
static char verticaltab[] = "\\v";
|
||||
static char tab[] = "\\t";
|
||||
|
||||
switch(*p) {
|
||||
case '\0':
|
||||
str = "\\0";
|
||||
str = nul;
|
||||
goto strpr;
|
||||
/* case '\a': */
|
||||
case '\007':
|
||||
if (deprecated) /* od didn't know about \a */
|
||||
break;
|
||||
str = "\\a";
|
||||
str = alarm;
|
||||
goto strpr;
|
||||
case '\b':
|
||||
str = "\\b";
|
||||
str = backspace;
|
||||
goto strpr;
|
||||
case '\f':
|
||||
str = "\\f";
|
||||
str = formfeed;
|
||||
goto strpr;
|
||||
case '\n':
|
||||
str = "\\n";
|
||||
str = newline;
|
||||
goto strpr;
|
||||
case '\r':
|
||||
str = "\\r";
|
||||
str = carriageret;
|
||||
goto strpr;
|
||||
case '\t':
|
||||
str = "\\t";
|
||||
str = tab;
|
||||
goto strpr;
|
||||
case '\v':
|
||||
if (deprecated)
|
||||
break;
|
||||
str = "\\v";
|
||||
str = verticaltab;
|
||||
goto strpr;
|
||||
default:
|
||||
break;
|
||||
@ -98,7 +108,7 @@ conv_u(pr, p)
|
||||
u_char *p;
|
||||
{
|
||||
extern int deprecated;
|
||||
static char *list[] = {
|
||||
static const char *list[] = {
|
||||
"nul", "soh", "stx", "etx", "eot", "enq", "ack", "bel",
|
||||
"bs", "ht", "lf", "vt", "ff", "cr", "so", "si",
|
||||
"dle", "dcl", "dc2", "dc3", "dc4", "nak", "syn", "etb",
|
||||
|
@ -69,7 +69,7 @@ display()
|
||||
off_t saveaddress;
|
||||
u_char savech, *savebp;
|
||||
|
||||
while (bp = get())
|
||||
while ((bp = get()))
|
||||
for (fs = fshead, savebp = bp, saveaddress = address; fs;
|
||||
fs = fs->nextfs, bp = savebp, address = saveaddress)
|
||||
for (fu = fs->nextfu; fu; fu = fu->nextfu) {
|
||||
@ -208,7 +208,7 @@ void
|
||||
bpad(pr)
|
||||
PR *pr;
|
||||
{
|
||||
static char *spec = " -0+#";
|
||||
static char spec[] = " -0+#";
|
||||
register char *p1, *p2;
|
||||
|
||||
/*
|
||||
@ -220,7 +220,7 @@ bpad(pr)
|
||||
pr->cchar[1] = '\0';
|
||||
for (p1 = pr->fmt; *p1 != '%'; ++p1);
|
||||
for (p2 = ++p1; *p1 && index(spec, *p1); ++p1);
|
||||
while (*p2++ = *p1++);
|
||||
while ((*p2++ = *p1++));
|
||||
}
|
||||
|
||||
static char **_argv;
|
||||
@ -228,7 +228,6 @@ static char **_argv;
|
||||
u_char *
|
||||
get()
|
||||
{
|
||||
extern enum _vflag vflag;
|
||||
extern int length;
|
||||
static int ateof = 1;
|
||||
static u_char *curp, *savp;
|
||||
@ -255,7 +254,7 @@ get()
|
||||
* and no other files are available, zero-pad the rest of the
|
||||
* block and set the end flag.
|
||||
*/
|
||||
if (!length || ateof && !next((char **)NULL)) {
|
||||
if (!length || (ateof && !next((char **)NULL))) {
|
||||
if (need == blocksize)
|
||||
return((u_char *)NULL);
|
||||
if (vflag != ALL &&
|
||||
@ -340,7 +339,7 @@ next(argv)
|
||||
|
||||
void
|
||||
doskip(fname, statok)
|
||||
char *fname;
|
||||
const char *fname;
|
||||
int statok;
|
||||
{
|
||||
register int cnt;
|
||||
|
@ -75,17 +75,17 @@ extern FS *fshead; /* head of format strings list */
|
||||
extern int blocksize; /* data block size */
|
||||
enum _vflag { ALL, DUP, FIRST, WAIT }; /* -v values */
|
||||
|
||||
void add __P((char *));
|
||||
void add __P((const char *));
|
||||
void addfile __P((char *));
|
||||
void badcnt __P((char *));
|
||||
void badconv __P((char *));
|
||||
void badfmt __P((char *));
|
||||
void badfmt __P((const char *));
|
||||
void badsfmt __P((void));
|
||||
void bpad __P((PR *));
|
||||
void conv_c __P((PR *, u_char *));
|
||||
void conv_u __P((PR *, u_char *));
|
||||
void display __P((void));
|
||||
void doskip __P((char *, int));
|
||||
void doskip __P((const char *, int));
|
||||
void escape __P((char *));
|
||||
u_char *get __P((void));
|
||||
void newsyntax __P((int, char ***));
|
||||
|
@ -79,9 +79,9 @@ addfile(name)
|
||||
|
||||
void
|
||||
add(fmt)
|
||||
char *fmt;
|
||||
const char *fmt;
|
||||
{
|
||||
unsigned char *p, *savep;
|
||||
unsigned const char *p, *savep;
|
||||
static FS **nextfs;
|
||||
FS *tfs;
|
||||
FU *tfu, **nextfu;
|
||||
@ -151,7 +151,7 @@ add(fmt)
|
||||
}
|
||||
}
|
||||
|
||||
static char *spec = ".#-+ 0123456789";
|
||||
static char spec[] = ".#-+ 0123456789";
|
||||
|
||||
int
|
||||
size(fs)
|
||||
@ -501,7 +501,7 @@ badsfmt()
|
||||
|
||||
void
|
||||
badfmt(fmt)
|
||||
char *fmt;
|
||||
const char *fmt;
|
||||
{
|
||||
errx(1, "\"%s\": bad format", fmt);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user