Commit Graph

106 Commits

Author SHA1 Message Date
christos 2782716bca better check st_size == 0, than st_dev == -1 2024-01-14 17:40:17 +00:00
christos dfd2ee048f PR/57851: Ricardo Branco: stat(2) does not return correct size information
for kernfs/procfs files. Minor KNF.
2024-01-14 16:42:58 +00:00
lukem c4b7a9e794 bsd.own.mk: rename GCC_NO_* to CC_WNO_*
Rename compiler-warning-disable variables from
	GCC_NO_warning
to
	CC_WNO_warning
where warning is the full warning name as used by the compiler.

GCC_NO_IMPLICIT_FALLTHRU is CC_WNO_IMPLICIT_FALLTHROUGH

Using the convention CC_compilerflag, where compilerflag
is based on the full compiler flag name.
2023-06-03 09:09:01 +00:00
mrg de11d87641 introduce some common variables for use in GCC warning disables:
GCC_NO_FORMAT_TRUNCATION    -Wno-format-truncation (GCC 7/8)
GCC_NO_STRINGOP_TRUNCATION  -Wno-stringop-truncation (GCC 8)
GCC_NO_STRINGOP_OVERFLOW    -Wno-stringop-overflow (GCC 8)
GCC_NO_CAST_FUNCTION_TYPE   -Wno-cast-function-type (GCC 8)

use these to turn off warnings for most GCC-8 complaints.  many
of these are false positives, most of the real bugs are already
commited, or are yet to come.


we plan to introduce versions of (some?) of these that use the
"-Wno-error=" form, which still displays the warnings but does
not make it an error, and all of the above will be re-considered
as either being "fix me" (warning still displayed) or "warning
is wrong."
2019-10-13 07:28:04 +00:00
dholland 6d1844cb1e Don't try to use stdin after clobbering it with a failed freopen().
Prevents an extra "Bad file descriptor" message when trying to hexdump
a single nonexistent file.

The intended behavior seems to have been to read from stdin if there
was one filename given and it wasn't valid. But this seems like a bad
idea, so prevent that case instead of hacking it up so it works.
2016-03-04 03:02:52 +00:00
dholland 7228911ac6 Don't use one function for two different things. Two functions is the
ticket.
2016-03-04 02:54:38 +00:00
dholland 63eec2f2f9 use "static" 2016-03-04 02:46:19 +00:00
christos 30eeb0614b don't read random garbage from the stack 2013-10-18 20:19:03 +00:00
jakllsch 556f85a303 "dcl" is not "dc1".
Fixes PR#47547
2013-02-09 02:49:36 +00:00
wiz 14716e14b6 Bug Hunting:
improve wording
2012-07-06 14:10:06 +00:00
wiz 4ac276bf48 From Bug Hunting:
- de-capitalize ``usage'' in `usage' message;
- synchronize `usage' message with man pages.
2012-07-06 09:06:43 +00:00
wiz 06bcaf248a From Bug Hunting:
- correct / improve macro usage;
- (re-)add an actual description in `DESCRIPTION' section;
- synchronize argument name to `-j' option;
- improve wording;
- bump date.
2012-07-06 09:05:26 +00:00
wiz f6de61aefa From Bug Hunting:
- sort options in `SYNOPSIS' and `DESCRIPTION' sections;
- correct / improve macro usage;
- synchronize argument name to `-s' option;
- improve punctuation / wording;
- augment `SEE ALSO' section;
- bump date.

While here:
Use Sq for single characters instead of Dq.
Use Aq instead of \*[Lt]...\*[Gt].
Mark up NULL with Dv.
2012-07-06 09:03:34 +00:00
wiz 1ac719d147 Remove unnecessary Bk/Ek pairs from SYNOPSIS.
No effective change except where I used the opportunity to sort options
and/or option descriptions.
2012-04-08 22:00:37 +00:00
joerg d6555585cf static + __dead 2011-09-04 20:27:05 +00:00
christos 4551250b00 document non-literal format strings. 2011-08-14 13:45:34 +00:00
wiz be4e8c8eb1 Replace "\t" with Ta in table.
Fixes output with mandoc. Noted by njoly.
2010-12-18 14:22:42 +00:00
mrg 347cb101f4 properly detect that we aren't od(1) and act as hexdump. fixes hexdump,
which also broke startx (second time this week!)

from mlelstv.
2010-11-28 10:45:32 +00:00
christos e45d815960 revert and fix the usage to be consistent with other programs. 2010-11-27 20:46:38 +00:00
dholland bb9db00d5a PR 44156: od -? prints usage for "hexdump" rather than "od" 2010-11-27 00:42:58 +00:00
mbalmer 945771eda0 DEL is 0x7F, not 0xFF. From FreeBSD via OpenBSD. 2010-02-27 10:45:23 +00:00
wiz 91440662bd Bump date for previous. 2010-02-09 14:25:39 +00:00
drochner ec10ab0177 remove agitation that od(1) was deprecated -- it is still POSIX 2010-02-09 14:06:37 +00:00
joerg 98ae2d6073 Do not use .Xo/.Xc to workaround ancient groff limits. 2009-10-14 17:44:25 +00:00
lukem c1ceae17f0 Enable WARNS=4 by default for usr.bin, except for:
awk  bdes  checknr  compile_et  error  gss  hxtool  kgetcred  kinit
	klist  ldd  less  lex  locale  login  m4  man  menuc  mk_cmds
	mklocale  msgc  openssl  rpcgen  rpcinfo  sdiff  spell  ssh
	string2key  telnet  tn3270  verify_krb5_conf  xlint
2009-04-14 22:15:16 +00:00
apb 53ee7761e4 Integer values, no matter what their width, are cast to int64_t or
uint64_t for printing.  Because of this, parse.c:rewrite() should use
PRI[diouxX]64 as the printf format; the previous revision which used
"lld" and friends was a temporary measure.  We assume that PRId64 ends
with 'd', PRIx64 ends with 'x', etc.

In display.c:display(), change some u_intNN_t types to C99 standard
uintNN_t types, and consistently cast to [u]int64_t when printing
integer values (even in two cases where it's not really necessary but it
makes the code look more consistent).
2009-01-18 21:34:32 +00:00
hans ec644bbf21 Use ll instead of non-standard q as length modifier in format strings.
Makes this work on Solaris. OK by apb.
2009-01-17 23:24:30 +00:00
drochner 316dc7a8ab Support -the "-A addressformat" flag for od(1), from FreeBSD.
(I found a script which tries to figure out the byteorder of a box
by "od -An | grep", but it is POSIX anyway.)
There is a little behavioural change: The whitespace without any arguments
is like "-to2" now; before it was custom. It's not worse imho.
2008-09-03 16:32:57 +00:00
lukem 98e5374ccb Remove the \n and tabs from the __COPYRIGHT() strings.
Tweak to use a consistent format.
2008-07-21 14:19:20 +00:00
martin 11a6dbe728 Convert TNF licenses to new 2 clause variant 2008-04-30 13:10:46 +00:00
christos be4d21eeca use ecalloc in previous 2006-10-09 14:27:06 +00:00
dsl 861fc6431d Fix core dump caused by non-zerod memory.
From Auster in current_users.
2006-10-09 11:37:31 +00:00
peter e263dfd62f WFORMAT is no more... 2006-10-08 17:52:28 +00:00
elad a01c1f4782 PR/28157: KAMADA Ken'ichi: escape sequence of hexdump(1) is broken
(SIGSEGV at worst)
Applied patch, thanks for the report!
2006-09-23 21:19:34 +00:00
hira fadb259b4d Fix uninitialized variables. 2006-09-05 12:11:27 +00:00
christos 505c9ab4bf protect libutil with hostprog 2006-08-29 17:00:28 +00:00
christos cdab3a7a06 More programs using efun. 2006-08-26 18:17:41 +00:00
dsl e4573e12e3 Simplify the way the end of a singly linked list is followed (for adding
items) so it is more obvious that we aren't going to indirect through
a null pointer.
Fixes coverty SID:101
2006-03-30 19:53:58 +00:00
perry d310ebb16a de-__P, ANSIfy prototypes 2006-01-04 01:30:21 +00:00
lukem a3b235bbd2 appease gcc -Wuninitialized 2005-06-02 01:53:01 +00:00
dsl b23af931be Add (unsigned char) cast to ctype functions 2004-10-30 17:43:02 +00:00
lukem 171d653219 Overhaul how `build.sh tools' are used:
*	Rename "config.h" to "nbtool_config.h" and
	HAVE_CONFIG_H to HAVE_NBTOOL_CONFIG_H.
	This makes in more obvious in the source when we're using
	tools/compat/config.h versus "standard autoconf" config.h

    *	Consistently move the inclusion of nbtool_config.h to before
    	<sys/cdefs.h> so that the former can provide __RCSID() (et al),
    	and there's no need to protect those macros any more.

These changes should make it easier to "tool-ify" a program by adding:
	#if HAVE_NBTOOL_CONFIG_H
	#include "nbtool_config.h"
	#endif
to the top of the source files (for the general case).
2003-10-27 00:12:41 +00:00
dmcmahill 188fcee35a add
#if HAVE_CONFIG_H
#include "config.h"
#endif
to get this to build under solaris-2.6/sparc with gcc-2.95.1 as part of
the NetBSD cross toolchain build.  Fixes PR23211.  Patch approved by
Alistair Crooks.
2003-10-22 12:30:39 +00:00
cl 7272f1e99e include <inttypes.h> to get uint64_t defined 2003-09-12 12:59:34 +00:00
wiz 3de6998961 This is a host tool: use {u,}int64_t instead of {u_,}quad_t. 2003-09-09 09:45:47 +00:00
agc 89aaa1bb64 Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22365, verified by myself.
2003-08-07 11:13:06 +00:00
wiz b93a29cdaa Fixes to make these man page look nice with groff-1.19. 2003-06-30 19:12:31 +00:00
lukem 826a14607a Now that <bsd.prog.mk> DTRT if HOSTPROG is defined (i.e, it is a no-op),
there's no need to special-case .include-ing it.
2003-05-18 07:57:31 +00:00
augustss 177beb544c Two more __RCSID checks that I missed. 2003-03-12 18:32:51 +00:00
augustss c8e6437c5e More tests if __RCSID is defined. 2003-03-12 18:26:32 +00:00