Commit Graph

9586 Commits

Author SHA1 Message Date
Ulf Lilleengen
6b807bd5a4 - Remove unused include path. 2010-03-03 08:24:15 +00:00
Ulf Lilleengen
1761232e1d - Revert Makefile to revision r203368, as the svn mv from contrib/csup replaced
the Makefile with a broken version.
2010-03-03 08:23:19 +00:00
Ulrich Spörlein
47e1a877c5 Always assign WARNS using ?=
- fix some nearby style bugs
- include Makefile.inc where it makes sense and reduces duplication

Approved by:	ed (co-mentor)
2010-03-02 16:58:04 +00:00
Ulf Lilleengen
b1a3479cb6 - Unmark authentication support as a TODO item. 2010-03-02 07:37:35 +00:00
Ulf Lilleengen
4b6675a6f8 - Move csup away from contrib/ and into usr.bin/. Software is no longer
contributed, and main development is happening in the FreeBSD repo.

Suggested by:	joel
2010-03-02 07:26:07 +00:00
Robert Watson
bd9e7af25e Prefer vocabulary of 'Current' and 'Limit' to 'Value' and 'Maximum' in
netstat -Q.

MFC after:	6 days
Sponsored by:	Juniper Networks
2010-03-01 12:11:37 +00:00
Robert Watson
88737be2dd Teach netstat -Q to work with -N and -M by adding libkvm versions of data
query routines.  This code is necessarily more fragile in the presence of
kernel changes than querying the kernel via sysctl (the default), but
useful when investigating crashes or live kernel state via firewire.

MFC after:	1 week
Sponsored by:	Juniper Networks
2010-03-01 00:46:45 +00:00
Ed Schouten
f319c4b9af Make pr build with WARNS=6. 2010-02-26 13:48:04 +00:00
Ed Schouten
81d01f896b Use time(NULL) instead of gettimeofday(), because we only need tv_sec. 2010-02-26 13:47:51 +00:00
Ruslan Ermilov
c59ee18a21 Fixed static linkage. 2010-02-26 09:41:16 +00:00
Ruslan Ermilov
bee10047c0 Fixed dependencies (make checkdpadd). 2010-02-25 20:24:19 +00:00
Robert Watson
f836657290 Update date on netstat(1) for -Q.
Suggested by:	bz
MFC after:	1 week
2010-02-22 16:05:45 +00:00
Robert Watson
0153eb6688 Teach netstat(1) to print out netisr statistics when given the -Q argument.
Currently supports only reporting on live systems via sysctl, kmem support
needs to be edded.

MFC after:	1 week
Sponsored by:	Juniper Networks
2010-02-22 15:57:36 +00:00
Ulrich Spörlein
8fa03d08ca Fix common misspelling of hierarchy
Pointed out by:		bf1783 at gmail
Approved by:		np (cxgb), kientzle (tar, etc.), philip (mentor)
2010-02-20 10:19:19 +00:00
Xin LI
0a167a9b98 Treat numbers after [Ee] a positive number rather than an invalid
one.
2010-02-20 01:23:15 +00:00
Xin LI
9b3e11b84b Add a reference to newly added seq(1) command.
Submitted by:	jilles
MFC after:	3 months
2010-02-20 00:16:44 +00:00
Xin LI
208987a53c Add seq(1), a small utility to generate sequence number.
Obtained from:	NetBSD
MFC after:	3 months
2010-02-19 23:54:12 +00:00
Tony Finch
86eea914a7 Update to upstream version 1.338
Fix a long-standing cpp compatibility bug: The -DFOO argument
(without an explicit value) should define FOO to 1 not to the empty
string.

Add support for CRLF newlines, based on a suggestion from Mark Rushakoff.

Obtained from:	http://dotat.at/prog/unifdef/
2010-02-19 16:54:51 +00:00
Gavin Atkinson
a17f9fd691 The correct value of DEL is 0x7f, not 0xff. This is purely a documentation
issue - od(1) and hexdump(1) behave as expected.

PR:		docs/143869
Submitted by:	gcooper
MFC after:	2 weeks
2010-02-18 19:06:30 +00:00
Warner Losh
30c1278f14 The kdump data stream is an unaligned data stream for stat and
sockaddr structures.  As such, we have top copy the data structure
into a local buffer before we can reference it, otherwise we have
unaligned references (these are fixed up automatically on some CPUs,
but not on others).  We do this unconditionally to make the code
easier to read and understand.

Submitted by:	Grzegorz Bernacki
2010-02-18 16:05:09 +00:00
Warner Losh
35873dcedb bc and dc are not BSD version, not GNU version. 2010-02-18 05:14:36 +00:00
Gavin Atkinson
7e66baa20b Bump .Dd for r203977
MFC after:	1 month
2010-02-16 22:55:38 +00:00
Gavin Atkinson
cf4bd0f272 Implement the rename query, for when a file with the same name as the one
about to be extracted already exists.  The question, and interpretation
of the response is deliberately compatible with Info-Zip.

This change was originally obtained from NetBSD, but has three changes:
 - better compatibility with Info-Zip in the handling of ^D
 - Use getdelim() rather than getline()
 - bug fix: != changed to == in the "file rename" code

I suspect the latter is also a bug in NetBSD, but I can't easily confirm
this.

PR:		bin/143307
Reviewed by:	rdivacky (change to unzip.c only)
Obtained from:	NetBSD src/usr.bin/unzip/unzip.c 1.8
MFC after:	1 month
2010-02-16 22:53:18 +00:00
Warner Losh
89f84ab0a5 The NetBSD Foundation has granted permission to remove clause 3 and 4
from their software.

Obtained from:	NetBSD
2010-02-16 21:43:57 +00:00
Gavin Atkinson
8310a1a27a The -newerXB option was being interpreted the same as the -newerXm option
as a check for F_TIME2_B was missing.  Fix this.

PR:		bin/138245
Submitted by:	"David E. Cross"  <crossd cs.rpi.edu>
MFC after:	1 month
2010-02-14 12:08:44 +00:00
Ruslan Ermilov
a66d183c7b Make manpage's SYNOPSIS match program's usage().
Submitted by:	Alexander Best (manpage)
2010-02-12 15:07:24 +00:00
Ed Schouten
7f5883ad7c Remove unneeded CFLAGS. 2010-02-10 07:15:21 +00:00
Ed Maste
a0b96fd411 Add new -o option (r203042) to manpage synopsis and usage().
Submitted by:	ru
2010-02-10 00:18:15 +00:00
Ed Schouten
65bcaaeca7 Don't let find(1) depend on struct timeb.
This structure is deprecated and only used by ftime(2), which is part of
libcompat. The second argument of get_date() is unused, which means we
can just remove it entirely.
2010-02-09 21:24:41 +00:00
Xin LI
07ea9a7c2f As it turns out, fmt(1) is being used by the base system as well as the
ports tree extensively and it is probably a good idea to keep it
regardless of NO_MAIL setting.

Reported by:	Alexander Best
Reviewed by:	antoine
X-MFC-With:	r203584
2010-02-09 18:22:26 +00:00
Gabor Kovesdan
769821053c - pt_BR.ISO8859-1 catalog
- Add link to pt_PT.ISO8859-1

Submitted by:	sylvio
Approved by:	delphij (mentor)
2010-02-09 10:47:44 +00:00
Rebecca Cran
c08dcaf147 Initialize the execfile argument to NULL instead of _PATH_DEVNULL. This allows the -M option to be used without specifying -N.
PR:	bin/138146
Approved by:	rrs (mentor)
MFC after:	3 days
2010-02-08 21:23:48 +00:00
Tim Kientzle
0086085a03 Simplify, remove unnecessary code. 2010-02-07 02:04:58 +00:00
Tim Kientzle
3b7dbff339 Merge a bunch of refactoring from Joerg Sonnenberger to
isolate common code used by tar and cpio (and useful to other
libarchive clients).  The functions here are prefixed with
"lafe" (libarchive front-end) to indicate their use.
2010-02-07 02:00:26 +00:00
Tim Kientzle
bb2f2a4024 Style & Portability: Use archive_entry methods to examine
file information, change some functions to static, remove
some unused headers.
2010-02-07 01:35:28 +00:00
Tim Kientzle
37ae97d43e Various portability workarounds for non-FreeBSD platforms. 2010-02-07 01:26:45 +00:00
Tim Kientzle
1ce4beea44 Restructure the logic that determines when we're crossing a mount
point.  In particular, this carves out a place for detecting and
excluding synthetic or network filesystems.
2010-02-07 01:22:55 +00:00
Tim Kientzle
95332e994e Minor code rework. 2010-02-07 01:16:05 +00:00
Tim Kientzle
2d9fd7eea6 Trim out some unused configuration variables, remove
some unused headers, etc.
2010-02-07 01:07:58 +00:00
Tim Kientzle
d180e2b3d4 Fill in some missing error handling, be a little more careful about
error reporting, prefer int64_t to off_t.
2010-02-06 20:41:25 +00:00
Tim Kientzle
c92560005d bsdtar doesn't actually know what compression is supported by libarchive
and it should not pretend that it does.  It should just pass along the
user's request and handle an error if it's not supported.
2010-02-06 20:36:14 +00:00
Tim Kientzle
12d4db7c3f Refactor the siginfo/sigusr1 handling. The read/write reporting
is sufficiently different that it was simpler to just put separate
reporting functions into read.c and write.c rather than try to have
a single all-purpose reporting function.
Switch to a custom function for converting int64_t to a string; in
the portable version, this saves a lot of configuration headaches
trying to decipher the platform printf().
2010-02-06 20:27:36 +00:00
Tim Kientzle
82fb15c15a Remove all traces of an experiment for handling "root" on Windows systems. 2010-02-06 19:56:32 +00:00
Tim Kientzle
2be336325b Reformat the Makefile slightly. 2010-02-06 19:53:48 +00:00
Tim Kientzle
67d6d61952 Allow -b up to 8192. I've had reports from people who routinely
use -b 2048 (1MiB block size).  Setting the limit to 8192 should
allow some room for growth while still helping people who mistakenly
put in byte counts here instead of block counts.
2010-02-06 19:48:59 +00:00
Tim Kientzle
ae41a0ad92 Diff reduction compared to portable bsdtar 2.8: Move the
program name into a global, which eliminates an extra
argument from a lot of places.
2010-02-06 19:44:37 +00:00
Jaakko Heinonen
c065c0b8e1 - Cast intptr_t, pid_t and time_t values to intmax_t and use %jd with
printf.
- Cast the system call return value to long and use %ld in a printf in
  ktrsysret().

PR:		bin/123774
MFC after:	2 weeks
2010-02-06 16:01:38 +00:00
Antoine Brodin
341631ae1a Document one more file descriptor type and two more vnode types.
MFC after:	2 weeks
2010-02-06 11:29:06 +00:00
Matt Jacob
adaa8f14dd Fix gcore so that it can have the '-s' flag without hanging. 2010-02-05 18:28:43 +00:00
Xin LI
89ff1978d6 Fix a bug in previous revision.
The bc(1) program may need to deal with files when it's being run in
interactive mode, so we can not blindly use interactive mode (in turn
use libedit) but need to check if the input source is really the standard
input.

This commit should fix a regression where 'bc -l' would not parse the
mathlib.

Reported by:	trasz
2010-02-05 18:17:17 +00:00
Xin LI
4218135bf7 Use libedit when interacting with tty, which provided history
functionality, etc. as did by GNU bc.

This also fixes an issue where BSDL bc can not handle very long
line.

Reported by:	imp
Reviewed by:	imp
2010-02-04 18:43:05 +00:00
Gabor Kovesdan
7121df6349 - style(9)
Approved by:	delphij (mentor)
2010-02-03 21:06:13 +00:00
Gabor Kovesdan
4ef0890415 - Remove dead variable assignments
- Fix -x

Submitted by:	uqs
Approved by:	delphij (mentor)
2010-02-03 19:13:41 +00:00
Gabor Kovesdan
12360c49dd - style.Makefile(5)
Submitted by:	uqs
Approved by:	delphij (mentor)
2010-02-03 19:12:27 +00:00
Randall Stewart
586df59eed This fix makes it so the args are malloc'd before
we use them (always a good idea ;-0)

This was found and fixed by JC

Obtained from:	JC (c.jayachandran@gmail.com)
2010-02-03 13:03:47 +00:00
Ulf Lilleengen
1282a5e283 - Add support for CVSup authentication mechanisms to csup.
- Include a cpasswd script performing the same mechanisms as the cvpasswd
  utility from CVSup.

PR:		bin/114129
Submitted by:	Petar Zhivkov Petrov <pesho.petrov -at- gmail.com>
MFC after:	1 month
2010-02-02 05:57:42 +00:00
Tim Kientzle
378b2ffde5 Support -V option to print a dot for each file processed.
Also, change the existing -vi behavior to send the filenames to
stderr rather than stdout, as GNU cpio does.

PR:             bin/141175
Submitted by:	Philip Kizer
MFC after:	14 days
2010-01-30 06:49:18 +00:00
Rebecca Cran
c2664eae38 Add my birthday.
Approved by:	rrs (mentor)
2010-01-29 14:41:16 +00:00
Ruslan Ermilov
8f5f49447d Eliminated nits from last commit.
OK'ed by:	rodrigc
2010-01-27 21:06:53 +00:00
Craig Rodrigues
ab13f9f29e Partial merge of man page cleanups from NetBSD:
revision 1.91
  Fri Nov 7 01:01:46 2003 UTC by lukem

  Add some subsections in the VARIABLE ASSIGNMENTS section.

  In the "modifier description" list, show each modifier with the leading `:'.
  Rationale: it's hard to search for modifiers without it, and we already do
  the same thing in the -options and .makecommands lists.  I now find it much
  easier to find the description for a modifier in the man page.

Obtained from: NetBSD
2010-01-27 02:38:10 +00:00
Beat Gaetzi
216b6ff21b Add my birthday to the calendar. 2010-01-26 21:36:11 +00:00
Alberto Villa
6cd31a97ea Add myself.
Approved by:	tabthorpe (mentor)
2010-01-26 20:39:27 +00:00
Ed Maste
8293a8fe11 Allow -o as a synonym for -s, for compatibility with other systems.
Using -s is preferred, but some existing scripts and makefiles expect
to get the system name from uname -o.

Reviewed by:	imp
2010-01-26 20:02:53 +00:00
Wesley Shields
89d06842d8 - Add myself. I forgot to do this when I got my commit bit. 2010-01-26 19:48:46 +00:00
Pyun YongHyeon
69618fcf1f Connect smbfs related libraries and tool on sparc64.
Reviewed by:	marius
2010-01-25 18:52:47 +00:00
Antoine Brodin
f50eacd5e2 Unbreak world WITHOUT_OPENSSL:
the new dc(1) depends on crypto(3) and bc(1) depends on dc(1).
2010-01-23 17:31:13 +00:00
Xin LI
ad4fe553c5 - Collapase short and long options together;
- Use consistent marking up with bc(1)'s reference section.

Reviewed by:	gabor
2010-01-22 23:50:46 +00:00
Xin LI
5690ece69f - Remove --debug option and intentionally undocument -d, which is only
kept for compatibility with 4.4BSD behavior.
 - Sync SYNOPSIS with usage().
 - Use an alternative way to represent short and long options which have
   same semantics.

Reviewed by:	gabor
2010-01-22 23:35:06 +00:00
Xin LI
7ffc8ae56e Move USD documents from /usr/share/doc/papers to to /usr/share/doc/usd.
Reviewed by:	gabor
2010-01-22 23:19:48 +00:00
Xin LI
097d042584 Makefile cleanups:
o Enable building of USD
 o Remove commented out targets
 o Remove WARNS?=6 lines since it's the default

Reviewed by:	gabor
2010-01-21 17:46:14 +00:00
Ed Schouten
0806dd9238 Remove stale references to utmp(5) and its corresponding filenames.
I removed utmp and its manpage, but not other manpages referring to it.
2010-01-21 17:25:12 +00:00
Gabor Kovesdan
fdf1f88bce Replace GNU bc/dc with BSDL versions ported from OpenBSD. They have a good
compatibility level with the GNU counterparts and have shown to be mature
enough. For now, the GNU versions aren't removed from the tree, just detached
from the build.

Sponsored by:		Google Summer of Code 2008
Portbuild run by:	erwin
Approved by:		delphij
2010-01-20 21:30:52 +00:00
Ed Schouten
32fc554ec6 Also print UNIX timestamps in getent utmpx output. 2010-01-20 21:12:30 +00:00
Tony Finch
8e23f2a641 Fix portability to 64 bit platforms.
printf("%.*s",i,s) expects an int not a ptrdiff_t

Thanks to bf1783 (at) googlemail.com for the bug report.
2010-01-19 20:35:44 +00:00
Ed Schouten
6628ca0a98 Make last(1) display the full log file.
I must have misread when I ported the original last(1) source code.
Instead of only processing the last 1024 entries, it reads them in in
chucks of 1024 entries at a time.

Unfortunately we cannot walk through the log file in reverse order,
which means we have to allocate a piece of memory to hold all the
entries. Call realloc() for each 128 entries we read.

Reported by:	Andrzej Tobola <ato iem pw edu pl>
2010-01-19 19:53:05 +00:00
Tony Finch
f20a8dd3ac Sync unifdefall with upstream. It no longer relies entirely on $PATH
to find unifdef, in order to support running the test suite before
installing.
2010-01-19 18:18:15 +00:00
Tony Finch
4992d459a5 Add a -o outfile option, which can be used to specify an output file. The
file can safely be the same as the input file.  Idea from IRIX unifdef(1).
This version fixes a bug in the NetBSD unifdef which refuses to
write to a -o outfile which does not exist.

Obtained from: NetBSD
2010-01-19 18:13:54 +00:00
Ed Schouten
093d0b6698 Also let getent(1) print values of ut_pid. 2010-01-18 10:50:25 +00:00
Ed Schouten
f6d189a9e4 Raise WARNS for various tools where possible.
Submitted by:	Marius Nünnerich <marius@nuenneri.ch>
2010-01-17 21:56:27 +00:00
Ruslan Ermilov
aa4a335bae Use the newly brought %U macro. 2010-01-15 16:01:22 +00:00
Ed Schouten
e3bc549c9f Fix a typo: accouting -> accounting. 2010-01-14 22:21:20 +00:00
Ed Schouten
5ab7f1fc40 Add wtmpcvt(1).
This utility allows users to convert their wtmp databases to the new
format. It makes no sense for users to keep their wtmp log files if they
are unable to view them.

It basically copies ut_line into ut_id as well. This makes it possible
for last(1) and ac(8) to match login records with their corresponding
logout record.
2010-01-14 20:58:45 +00:00
Ed Schouten
c0d87a13b2 The group field is called gid', not group'. 2010-01-14 11:03:26 +00:00
Edwin Groothuis
04961257f8 Make whois capable of searching for IPv6 addresses just like it can
do for IPv4 addresses without having to explicetly specify that the
ARIN server should be used to get the initial information

PR:		bin/128725
Submitted by:	"Matt D. Harris" <mdh_lists@yahoo.com>
MFC after:	1 week
2010-01-14 10:56:54 +00:00
Edwin Groothuis
3b81fe7712 Remove -d option, whois.nic.mil doesn't exist anymore.
PR:		bin/142507
Submitted by:	Dan Mahoney <danm@prime.gushi.org>
MFC after:	1 week
2010-01-14 10:40:54 +00:00
Ed Schouten
ab90a4d1e2 Perform all trivial ports to utmpx for usr.bin/.
They were already converted to use libulog, so it's easy to convert them
to utmpx.
2010-01-13 18:09:54 +00:00
Ed Schouten
1131779fb3 Port w(1) to utmpx.
Let it print "-" when the TTY string is empty. In this case, it must
also make sure it doesn't match processes who also have no controlling
TTY. Otherwise it will print random kernel processes when trying to pick
the best matching process.

Eventually it should look at the value of ut_pid as well.
2010-01-13 18:09:21 +00:00
Ed Schouten
86586473e3 Allow getent(1) to display utmpx entries as well.
Because getutxent also matches the typical get*ent format of library
routines, I thought it would be a good idea to teach it how to read
utmpx databases. getent(1) just gives a raw dump, which is very useful
when debugging problems related to parsing/logging.
2010-01-13 18:08:00 +00:00
Ed Schouten
561f61e25d Port last(1) to use utmpx.
Basically there are three major things I changed about last(1):

- It should use ut_type instead of determining by hand what type of
  record was given.
- It should now keep track of ut_id's instead of TTYs. This means the
  ttylist has been renamed to the idlist, storing all the ut_id's it has
  processed until the next reboot.
- I've removed the signal handler. Because our wtmp is rotated so often,
  it makes little sense. Even on a simple piece of hardware it should be
  capable of grinding through megabytes of logs in a second.
2010-01-13 18:06:31 +00:00
Ed Schouten
550dcc5960 Migrate finger(1) towards utmpx.
It was already ported to use libulog, which makes it simpler now. Be
sure to catch the error returned by setutxdb(). Otherwise it may perform
a lookup on the utx.active database.
2010-01-13 17:50:58 +00:00
Hartmut Brandt
cd7215ceba Fix the previous commit (still not used to svn vs. cvs). Use the
define from paths.h for the default temporary directory and remove
and unneccessary getenv call.
2010-01-11 09:16:42 +00:00
Xin LI
bf10ffe1d3 Add a new option, -q howmany, which when used in conjuction with -w,
exits netstat after _howmany_ outputs.

Requested by:	thomasa
Reviewed by:	freebsd-net (bms, old version in early 2007)
MFC after:	1 month
2010-01-11 03:00:17 +00:00
Ed Schouten
85277f1350 Let lastcomm(1) build without <utmp.h>.
Use MAXLOGNAME - 1 instead of UTNAMESIZE. There is no definition for TTY
name sizes, at least not as low as 8, so hardcode it for now.
2010-01-10 21:59:06 +00:00
Hartmut Brandt
f7ea64353c Make make respect the TMPDIR environment variable.
PR:		bin/115447
Submitted by:	Eugene Grosbein
2010-01-10 20:26:03 +00:00
Ruslan Ermilov
d98dd8e5f9 Apply patches directly to sources. Their effect is as follows:
- Make one-true-awk respect locale's collating order in [a-z]
  bracket expressions, until a more complete fix (like handing
  BREs) is ready.

- Don't require a space between -[fv] and its argument.
2010-01-10 08:02:07 +00:00
Ruslan Ermilov
bd0e3681f9 Regen diffs. 2010-01-09 23:34:45 +00:00
Ruslan Ermilov
91217c1c70 Update to a 26-Nov-2009 release. 2010-01-09 23:19:01 +00:00
David Malone
a095a78a13 This now passes a make universe with WARNS=6. 2010-01-08 11:16:58 +00:00
David Malone
54767bf590 This now passes a make universe with WARNS=6. 2010-01-07 09:47:05 +00:00
David Malone
57f11f69e7 This now passes a make universe with WARNS=6. 2010-01-07 09:45:15 +00:00
Tim Kientzle
12255fe0d9 When restoring files, use the mode for the mode.
Thanks to: Jun Kuriyama for pointing this out
2010-01-06 06:35:10 +00:00
David Malone
77986b3db1 1) Mark usage as dead2.
2) Deregister.
3) New style function definitions.

Some WARNS still remain here - some printf format warning on some
arches and the compiler can't see that a variable should always be
initialised.
2010-01-05 21:09:59 +00:00
David Malone
02f563767b Shuffle parens to avoid type-punning warning. 2010-01-05 21:00:23 +00:00
David Malone
c4e3e4f1b5 1) Make usage() as dead2 - it helps the compiler know that some vars
are not used uninitialised.
2) Fix some constness problems.
3) Avoid a signedness problem by casting to size_t. If bn != stuff,
than stuff-1-bn should be > 0.
2010-01-05 20:53:55 +00:00
David Malone
e42dd26ae1 Change a char that is used as an index into an array into an unisgned char.
Add a missing new style function definition.
2010-01-05 20:32:08 +00:00
David E. O'Brien
290dac20e6 Add ability to search up the directory hierarchy for the system directory.
Do by specifying ".../" with '-m' or MAKESYSPATH (new) environment variable.

Reviewed by:	<sjg@NetBSD.org>
Obtained from:	NetBSD (+ embellishment by me, sent back to NetBSD)
2010-01-04 18:57:22 +00:00
Konstantin Belousov
4176dd5267 Modernize scandir(3) and alphasort(3) interfaces according to the IEEE
Std 1003.1-2008. Both Linux and Solaris conforms to the new definitions,
so we better follow too (older glibc used old BSDish alphasort prototype
and corresponding type of the comparision function for scandir). While
there, change the definitions of the functions to ANSI C and fix several
style issues nearby.

Remove requirement for "sys/types.h" include for functions from manpage.

POSIX also requires that alphasort(3) sorts as if strcoll(3) was used,
but leave the strcmp(3) call in the function for now.

Adapt in-tree callers of scandir(3) to new declaration. The fact that
select_sections() from catman(1) could modify supplied struct dirent is
a bug.

PR:	standards/142255
MFC after:	2 weeks
2010-01-04 15:40:17 +00:00
David E. O'Brien
bfc4c0cf08 Report lines that ought to contain a ':' operator but start with a '.'
as "Unknown directive" sinze they are more likely to be .elseif (etc).
(NetBSD PR 37222).

Obtained from:	NetBSD
2010-01-04 00:49:04 +00:00
David E. O'Brien
6100e6c2c9 Add check for subversion "original" marker. 2010-01-04 00:32:22 +00:00
Gavin Atkinson
9dfc434d60 Fix return code in the case of successful file transfer, broken in
tftp.c 1.13

PR:		bin/117452
Submitted by:	Spencer Minear  minear securecomputing.com
Approved by:	ed (mentor)
MFC after:	2 weeks
2010-01-03 13:48:58 +00:00
Ed Schouten
b7946da96b Build usr.bin/ with WARNS=6 by default.
Also add some missing $FreeBSD$ to keep svn happy.
2010-01-02 10:27:05 +00:00
Ed Schouten
01cc221b4c Mute some warnings on uninitialized variables.
The code does the right thing, but the compiler is unable to figure it
out. All paths that use that variable use the same invariant.
2010-01-02 10:14:35 +00:00
Ed Schouten
d93708c3e6 Remove a warning by adding extra parentheses.
GCC generates warnings when using "if (foo = bar)". In this case its use
is valid.
2010-01-02 10:13:21 +00:00
Ed Schouten
b3c73ef101 Add missing #include for string routines. 2010-01-02 10:12:12 +00:00
Ed Schouten
ef636796f6 ANSIfy various tools in usr.bin/.
Most of these tools properly build at WARNS=6, except for their K&R
function declarations. Fix this, so we can bump WARNS as well.
2010-01-02 10:09:20 +00:00
Brooks Davis
a6fffd6cb0 The devices that supported EVFILT_NETDEV kqueue filters were removed in
r195175.  Remove all definitions, documentation, and usage.

fifo_misc.c:
	Remove all kqueue tests as fifo_io.c performs all those that
	would have remained.

Reviewed by:	rwatson
MFC after:	3 weeks
X-MFC note:	don't change vlan_link_state() function signature
2009-12-31 20:29:58 +00:00
Ruslan Ermilov
8181961a73 Treat an empty argument as an error, instead of fetching the
contents of the root directory.

MFC after:	1 week
2009-12-30 23:01:49 +00:00
Ed Schouten
a6c287f615 Let both yacc and lex generate code that passes -Wold-style-definition.
Both these tools emit code where several functions have no `void'
keyword placed in the arugment list when the function has no arguments.
2009-12-30 22:46:08 +00:00
Ed Schouten
10bc3a7f42 ANSIfy almost all applications that use WARNS=6.
I was considering committing all these patches one by one, but as
discussed with brooks@, there is no need to do this. If we ever
need/want to merge these changes back, it is still possible to do this
per application.
2009-12-29 22:53:27 +00:00
Ed Schouten
8a036b7c03 Add missing `void' keyword. 2009-12-29 22:33:07 +00:00
Ed Schouten
645e7f1b9d Add missing `void' keyword. 2009-12-29 22:32:43 +00:00
Ed Schouten
0970727f4f Add missing `void' keyword for function without arguments. 2009-12-29 08:54:03 +00:00
Tim Kientzle
dc7c0661df ar only needs to support ar format. 2009-12-29 05:58:40 +00:00
Ed Schouten
70ad88f354 Migrate finger(1) away from <utmp.h>.
Unfortunately it also uses lastlog, which means we must resort to local
extensions of the utmpx-interface. Because the user name and TTY name
are now nul-terminated, there is no need to copy around strings as
often.
2009-12-28 20:54:34 +00:00
Ed Schouten
444999a314 Several refinements to libulog's API.
- Only set the fields in the ulog_utmpx structure that are valid for the
  command in question. This means that strings like "shutdown" or "~"
  are not visible to the user anymore.
- Rename UTXF_* to UTXI_*, indicating the indexation, instead of using
  the `antique' filename. If we ever get rid of utmp, it makes little
  sense calling it by its old name.
2009-12-26 22:36:05 +00:00
Xin LI
e8406463e8 Fix grammar and reduce ambiguity.
Submitted by:	b. f. <bf1783 googlemail com>
2009-12-26 00:46:05 +00:00
Ed Schouten
b1625b09d9 Let the width of the username column depend on the rwho file format.
Right now the code uses UT_NAMESIZE, but this makes little sense,
because rwho(1) parses files generated by rwhod(8). Not utmp(5) files.
2009-12-25 20:07:48 +00:00
Xin LI
893d013cf6 Document the difference between FreeBSD and traditional System V killall
commands.

MFC after:	1 month
2009-12-25 10:01:35 +00:00
Ed Schouten
2b6d81c176 Allow proper tracing of posix_openpt(2). 2009-12-23 15:22:50 +00:00
Jaakko Heinonen
a49365ac09 Don't print the archive name with -p and -q options.
PR:		bin/141280
Approved by:	des, trasz (mentor)
2009-12-22 15:13:16 +00:00
Xin LI
13cf266e82 Plug a memory leak.
PR:		bin/141836
Submitted by:	Henning Petersen <henning.petersen at t-online.de>
MFC after:	2 weeks
2009-12-21 19:15:30 +00:00
Jaakko Heinonen
55a8d2bb22 Cast time_t values to intmax_t and use %jd with printf.
OK'ed by:	delphij
Approved by:	trasz (mentor)
2009-12-21 17:41:57 +00:00
Jaakko Heinonen
c059fa2e24 Remove non-working special case for pipe(2) from amd64-fbsd32.c and
i386-fbsd.c. Add pipe(2) to syscall table to decode it's pointer
argument properly and re-add special handling for pipe(2) return value
to print_syscall_ret().

PR:		bin/120870
Approved by:	trasz (mentor)
2009-12-21 17:38:13 +00:00
Dag-Erling Smørgrav
fcdb43ba01 Note that sockstat(1) does not display kernel-owned sockets.
Submitted by:	infofarmer@
MFC after:	2 weeks
2009-12-21 17:23:04 +00:00
Jaakko Heinonen
ecbb6d348f Avoid sharing the file descriptor of the output file with traced
processes by setting the FD_CLOEXEC flag for the output file.

PR:		bin/140493
Submitted by:	Erik Lax
OK'ed by:	delphij
Approved by:	trasz (mentor)
2009-12-20 11:00:53 +00:00
Jaakko Heinonen
76de696d6a Add fork(2), getegid(2), geteuid(2), getgid(2), getpid(2), getpgid(2),
getpgrp(2), getppid(2), getsid(2) and getuid(2) to syscall table to
decode their arguments correctly.

OK'ed by:	delphij
Approved by:	trasz (mentor)
2009-12-20 10:58:34 +00:00
Edwin Groothuis
d14ec16633 Nationalise Easter -> Pasen
MFC after:	1 week
2009-12-17 20:41:59 +00:00
Jaakko Heinonen
a8092021a0 Sync getline() with comm(1):
- Prevent overflowing of the buffer length variable in getline() by
   limiting its maximum value.
 - Exit if reallocf(3) fails in getline(). Failure was silently
   considered as end-of-file.

Reviewed by:	ghelmer
Approved by:	trasz (mentor)
2009-12-17 17:03:47 +00:00
Jaakko Heinonen
698f926389 The input line length limit mentioned on the manual page was removed by
r176119.

Approved by:	trasz (mentor)
2009-12-17 16:59:19 +00:00
Stanislav Sedov
4ee23f5ee8 - Partially revert r200417. config.h brings several definitions,
that appears to be actually used.  Without config.h included
  cross-build of world failed (at least for ARM).
2009-12-17 12:42:45 +00:00
Ralf S. Engelschall
a752c19301 rewind(3) is already declared to return 'void', so no need for an explicit cast 2009-12-17 08:42:44 +00:00
Ralf S. Engelschall
1e3249cb9b DEBUG is either defined or not defined for the 'calender' sources, so use #ifdef and not just #if -- both to be semantically correct and also to be aligned with the rest of the 'calendar' sources 2009-12-17 08:41:06 +00:00
Ralf S. Engelschall
9ed01df370 remove external reference to not (or at least no longer) existing variable 'myname' 2009-12-17 08:37:02 +00:00
Edwin Groothuis
58fe9c40b1 Add Australian, New Zealand and Ukraian calendars to the "all" target".
MFC after:	1 week
2009-12-17 07:18:06 +00:00
Jaakko Heinonen
e8861840c8 - Prevent overflowing of the buffer length variable in getline() by
limiting its maximum value.
- Exit if reallocf(3) fails in getline(). Failure was silently
  considered as end-of-file.

Reviewed by:	ghelmer
Approved by:	trasz (mentor)
2009-12-16 14:34:48 +00:00
Xin LI
49ecc22cc7 Style improvements:
- Sort function prototypes;
 - Apply static on all function bodies.  To quote bde@:

> It is a good obfuscation to declare functions as static only in the
> prototype, so that you can't see the static for the actual function.
> The reverse obfuscation (with static only in the function definition)
> would make more sense, but is a constraint error.

Reviewed by:	bde
2009-12-14 16:54:39 +00:00
Xin LI
d993d09a6c - Remove times.h from C programs that does not manipulate with time at
all.
 - Remove pathnames.h from all but io.c since it's the only module that
   used these definations.
2009-12-13 04:50:11 +00:00
Xin LI
3cd983c5b9 egetopt.c does not use any stdlib.h definations, nor it referenced any
symbol from other module, so remove reference of stdlib.h and extern.h.

Verified with:	md5(1)
2009-12-13 04:34:51 +00:00
Xin LI
f449446e45 Use ANSI prototype for foldit(). 2009-12-13 04:14:55 +00:00
Xin LI
b4d09565cf xinstall.c does not require ctype functions, so ctype.h is not
necessary here.

Note: this would change the md5 checksum due to change caused
by different register layout.
2009-12-13 03:53:15 +00:00
Xin LI
820aa90f57 Staticify internal functions and make usage() a prototype. 2009-12-13 03:34:19 +00:00
Xin LI
7d0d4ebc83 Use prototype for usage(). 2009-12-13 03:18:37 +00:00
Xin LI
821df508e8 Revert most part of 200420 as requested, as more review and polish is
needed.
2009-12-13 03:14:06 +00:00
Jaakko Heinonen
d8eba599f5 Don't read the newline character to line buffer because lines are passed
to wcscoll(3). Newline characters could cause incorrect results when
comparing lines.

Also, if an input line didn't contain a newline character, it was
omitted from the output. According to my interpretation, SUSv3 requires
that the newline is always printed.

Add regression tests for the cases. [1]

PR:		bin/140976
Submitted by:	D'Arcy Cain (original version) [1]
Approved by:	trasz (mentor)
2009-12-12 18:18:46 +00:00
Jaakko Heinonen
28c3507d53 The input line length limit mentioned on the manual page was removed by
r179374.

Approved by:	trasz (mentor)
2009-12-12 18:04:50 +00:00
Xin LI
6f2d322192 Remove unneeded header includes from usr.bin/ except contributed code.
Tested with:	make universe
2009-12-11 23:35:38 +00:00
Xin LI
e87862f53a Remove unnecessary termcap.h includes inherited from extern.h and other
unneeded headers.  While I'm there, make function definations ANSI
prototypes.
2009-12-11 23:30:22 +00:00
Xin LI
3daadfc833 Move unistd.h includes to individual .c files and remove unnecessary
includes.
2009-12-11 23:23:57 +00:00
Xin LI
512be259a7 Remove unnecessary includes.
Reviewed by:	rodrigc
2009-12-11 23:20:02 +00:00
Gavin Atkinson
ad61078f87 Add my birthday.
Approved by:	ed (mentor)
2009-12-09 22:03:57 +00:00
Ed Schouten
dc65bcacb2 Let w(1) use utmpx.
We don't have UT_*SIZE anymore. One of the reasons for that is because
all strings are null terminated, there is no need for apps to copy
strings out of the utmpx structure. This means we can define W_DISP*SIZE
lengths for all columns.

While there, adjust the sizes a little. Steal some bytes from the
username column, while extending the hostname column quite a bit.
2009-12-06 01:10:30 +00:00
Ed Schouten
3487b13416 Let systat's vmstat use utmpx. 2009-12-05 20:52:11 +00:00
Ed Schouten
b911cea8ff Port who(1) to utmpx.
(Un)fortunately there is no standardized interface to switch between
utmp database files, so we must call ulog_setutxfile() here.

I'm also changing the column widths to magic numbers here. Display
layout should in this case not be derived from structure fields sizes.
Because I don't want struct utmpx ever to become too small, the fields
are too big to reserve all the space.
2009-12-05 20:44:19 +00:00
Ed Schouten
5095053036 Let wall(1) use utmpx.
Because our implementation guarantees the strings inside struct utmpx to
be null terminated, we don't need to copy everything out, which makes
the code nicer to read.

Also set WARNS to 6 and add $FreeBSD$ to keep SVN happy.
2009-12-05 20:22:26 +00:00
Ed Schouten
bd76376f80 Let wall(1) use utmpx.
Because our implementation guarantees the strings inside struct utmpx to
be null terminated, we don't need to copy everything out, which makes
the code nicer to read.

Also set WARNS to 6 and add $FreeBSD$ to keep SVN silent.
2009-12-05 20:05:25 +00:00
Ed Schouten
6951e12ec7 Add WARNS?=6, because it seems to build out of the box. 2009-12-05 19:55:26 +00:00
Ed Schouten
cfe41e3b68 Use _ULOG_POSIX_NAMES here, to make eventual porting to <utmpx.h> easier.
By the time we gain a real <utmpx.h>, it's just a matter of changing the
include at the top and -lulog from the Makefile.
2009-12-05 19:54:37 +00:00
Stefan Farfeleder
023c421a96 Add a missing space to the error message when execvp() failed. 2009-12-05 13:12:04 +00:00
Roman Divacky
4c0191c569 Connect unzip to the build.
Approved by:	ed (mentor)
Approved by:	des (unzip author)
Tested by:	exp ports build (miwi)
2009-12-03 18:02:55 +00:00
Ed Schouten
178442d07a Use USER_PROCESS instead of LOGIN_PROCESS.
POSIX isn't clear about how the fields should be used, but according to
utmpx(5) on Linux, LOGIN_PROCESS refers to a TTY that's still running a
getty.
2009-12-03 17:05:36 +00:00
Ed Schouten
42b525af6e Port users(1) to libulog.
Instead of digging through the utmp database by hand, use proper API
calls to do so.  Instead of parsing entries with a non-empty ut_user, we
now look at LOGIN_PROCESS entries.
2009-12-03 16:42:18 +00:00
John Baldwin
3ee7e0d48e Remove -t from the manpage and usage. 2009-12-01 15:18:25 +00:00
Bjoern A. Zeeb
aaae58c491 Unbreak user space after if_timer/if_watchdog removal in r199975.
Tested by:	glebius
2009-12-01 14:56:00 +00:00
Bjoern A. Zeeb
90b4c081d0 Add more statistics variables for IPcomp.
Try to version the struct in a backward compatible way.
People asked for the versioning of the stats structs in general before.

MFC after:	5 days
2009-11-29 20:37:30 +00:00
Daniel Gerzo
a2ec746f79 - correctly render the provided example
PR:		docs/140962
Submitted by:	mharo
2009-11-28 11:05:22 +00:00
Tony Finch
137f2acad4 unifdef: fix invalid array access when nesting limit exceeded
If the number of nested #if blocks exceeds 64, nest() increments
the nesting depth and then reports an error.  The message includes
the line number for the start of the current #if block, which is
read from past the end of the relevant array.

Avoid the out-of-bounds read by reporting the error and exiting
before the nesting depth has a chance to increase.

Submitted by: Jonathan Nieder <jrnieder@gmail.com>
2009-11-27 17:53:49 +00:00
Tony Finch
84a3c48bb4 unifdefall: optimise the loop that builds the unifdef command.
The old code used a shell loop to convert each controlling macro
definition into a command-line argument, reading the macro definitions
file each time. The new code converts the list of controlling macros
into a sed script which can run through the list of macro definitions
in one go.

Add some explanatory comments, since the code is quite meta.

Use {} instead of () for redirecting a group of commands.

Submitted by: Jonathan Nieder <jrnieder@gmail.com>
2009-11-26 19:08:33 +00:00
Tony Finch
8af26c5e86 Remove debugging remnants from unifdefall.
Submitted by:	Jonathan Nieder <jrnieder@gmail.com>
2009-11-26 02:14:08 +00:00
Tony Finch
f6f85e213e Update unifdef to my upstream version 1.188
Main highlights:

(A) The new -B option compresses blank lines around a deleted section
    so that blank lines around "paragraphs" of code don't get doubled.

(B) Lenient evaluation of && and || so that #if expressions can be
    evaluated even when some of their sub-expressions cannot be.

(C) The evaluator can now handle macros with arguments.

(D) Portability fixes, especially for unifdefall.

Contributions from:
Ben Hutchings at Solarflare Communications (A and B)
Anders H Kaseorg <andersk@mit.edu> (A and C)
Jonathan Nieder <jrnieder@gmail.com> (D)

Obtained from:  http://dotat.at/prog/unifdef/
2009-11-25 20:23:18 +00:00
Attilio Rao
2e7ecbfbc8 Change gcore in order to get rid of the procfs accesses and use FreeBSD's
specific sysctls and ptrace interfaces.
This change switches a bit gcore POLA that is summarized here:
- now gcore can recognize threads within the process and handle dumps
  on thread-scope
- the process to be analyzed will be stopped during its gcore run
- gcore may not work with processes which are actively being analyzed
  by gdb or truss
- the ptrace interface may cause syscalls to return EINTR, thus
  interferring with signals handling within the process

Side note: <janitor task> the interface can be further lifted in order to
get rid of the very last procfs interfaces remnants and made more
suitable for copying with sysctl/ptrace interface </janitor task>.

Obtained from:	Sandvine Incorporated
Reviewed by:	emaste, rwatson
Sponsored by:	Sandvine Incorporated
MFC:		1 month
2009-11-25 15:23:14 +00:00
Attilio Rao
d72dc9a7eb Add the possibility to show informations about dropped packets on the
input path when showing informations about the interfaces.

Obtained from:	Sandvine Incorporated
Reviewed by:	emaste
Sponsored by:	Sandvine Incorporated
MFC:		2 weeks
2009-11-25 15:02:32 +00:00
Hajimu UMEMOTO
b94f6865f9 When -n is specified, attempt to turn hostnames found in utmp into IP
addresses, again.  However, change a hostname into an IP address, only
when a host has just one A/AAAA RR.

Requested by:	candy__at__kgc.co.jp
MFC after:	2 weeks
2009-11-22 16:51:44 +00:00
Edwin Groothuis
ec9f71c489 The output of perror(1) is now showing local messages for locales
supported by libc/nls

PR:		bin/140499
Approved by:	gnn@
2009-11-22 05:17:22 +00:00
David E. O'Brien
1511301cd8 Catch up with r144020's /Dir_FindFile/Path_FindFile/ 2009-11-17 19:35:39 +00:00
David E. O'Brien
952ffdb9da Garbage collect some old #ifdef'ed code from 1994 that causes vi's '%'
to be unable to find a match in Path_FindFile().
2009-11-17 16:26:45 +00:00
Xin LI
a0b4046b01 We should distinguish between a real truncated case and EOF after
BZ_STREAM_END triggered re-init.  Do it by introducing a new flag
to represent the 'cold' case after bzip2 state is reinitialized.

This fixes regression reported on -current@ as well as another one
I found during twiddling with gzip.

Reported by:	swell.k gmail.com
MFC after:	1 week
2009-11-16 22:52:52 +00:00
Colin Percival
22ce05c97c Update malloc utrace structure parsing to reflect the change (r199265)
in how malloc_init is logged from (0, 0, 0) to (-1, 0, 0).

While we're here, simplify the logic.

Reviewed by:	jhb (earlier version)
2009-11-14 09:33:51 +00:00
Hajimu UMEMOTO
347c7f559c Use ncursesw to output the date field of vmstat display
with multi-byte string, correctly.
2009-11-13 03:59:44 +00:00
Edwin Groothuis
c2eeded255 Although the file has "ex:ts=4", do some " " -> \t translations
so that it is also nicely readable with ts=8.
2009-11-12 21:51:01 +00:00
Xin LI
0c10c611ff Apply a NetBSD fix (revision 1.12) to handle multi-session bzip2 files
as created by pbzip2.

Submitted by:	mrg (NetBSD.org)
MFC after:	1 week
2009-11-09 02:37:02 +00:00
Attilio Rao
48f6dd8a8c Use a safety belt for cases where corrupted narg can be passed to the
ktrsyscall(). print_number() does decrement the number of arguments,
leading to infinite loops for negative values.

Reported by:	Patrick Lamaiziere <patpr at davenulle dot org>,
		Jonathan Pascal <jkpyvxmzsa at mailinator dot com>
Submitted by:	jh
PR:		bin/120055, kern/119564
MFC:		1 week
2009-11-07 21:46:34 +00:00
Xin LI
49fc79609a Static'ify signal handler which is not called from outside. 2009-11-03 09:25:08 +00:00
Christian Brueffer
cf6c5eebe7 Use our canonical .Dd format.
Submitted by:	Ulrich Spoerlein
2009-11-02 12:35:38 +00:00
Kirk McKusick
4145bb53bf When reading input from a file or device (via -f option) set the
input to be in non-buffering mode so that input lines are logged
as they occur rather than being saved up until a buffer's worth of
input has been logged.
2009-10-30 21:54:53 +00:00
Colin Percival
2bc706c648 Add notes pointing out that bsdiff does not store file hashes and
bspatch thus does not verify file hashes, and that consequently it
is recommended that users store hashes separately and verify files
before and after running bspatch.

Requested by:	BugMagnet
MFC after:	1 week
2009-10-30 11:13:00 +00:00
John Baldwin
f786e2f82e When fetching sum stats (vmstat -s) from a crash dump, fetch per-CPU counts
and sum them to form the total counts.

PR:		bin/135893
Submitted by:	Mikolaj Golub  to my trociny of gmail
MFC after:	1 week
2009-10-29 17:34:02 +00:00
Kirk McKusick
37ed8e48db Update to work with quotafile functions in -libutil. 2009-10-21 04:35:09 +00:00
Max Khon
ab5f4f723d Reset UPTODATE gnodes after remaking makefiles when make
is not going to be restarted: such nodes could be marked UPTODATE
without doing rebuild due to remakingMakefiles being TRUE.
2009-10-18 11:28:31 +00:00
Max Khon
a234abce8e Exit with non-zero error code in case of errors
when make is run with -k and not parallel (compat) make is run.
2009-10-18 11:26:09 +00:00
Jaakko Heinonen
c64b097bfc - If lstat()/stat() fails with an error other than ENOENT, don't ignore
the error and assume that the file doesn't exist. Touch could return
  success with -c option even if the file existed and time was not set.
- If the first utimes_f() call fails with -A option, give up and don't
  continue trying to set times to current time. [1]
- Set exit status to 1 when setting of timestamps fails for a directory
  or symbolic link even though lstat()/stat() would succeed.
- Don't print bogus error message when rw() succeeds.

PR:		bin/112213
Submitted by:	jilles [1]
Reviewed by:	jilles
Approved by:	trasz (mentor)
2009-10-16 20:52:45 +00:00