Commit Graph

45 Commits

Author SHA1 Message Date
Joel Dahl
da52b4caaf Remove the advertising clause from UCB copyrighted files in usr.bin. This
is in accordance with the information provided at
ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change

Also add $FreeBSD$ to a few files to keep svn happy.

Discussed with:	imp, rwatson
2010-12-11 08:32:16 +00:00
Jaakko Heinonen
12794df244 - Use errx(3) instead of err(3) when checking if snprintf(3) succeeded.
snprintf(3) doesn't set errno in the tested cases.
- If the same argument reference (for example %1) was specified more than
  once, the command didn't necessarily fit to the final command buffer. Fix
  this using a dynamic sbuf buffer. Add a few regression tests for the case.

PR:		bin/95079
No objections:	freebsd-hackers
2010-03-05 15:23:01 +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
Ruslan Ermilov
6a2561eb26 It's `apply echo *'' that is similar to ls -1'', not `apply echo a*''.
Submitted by:	sat
2006-12-13 08:13:14 +00:00
Ruslan Ermilov
6c7216df78 Sort sections. 2005-01-18 13:43:56 +00:00
Tim J. Robbins
3d1a01487a Document incorrect handling of multibyte characters. 2004-07-17 04:04:30 +00:00
Philippe Charnier
3adb4d32aa Revert previous commit, from Bruce:
This is a style bug.  err() is declared is non-returning so that every
  use of it doesn't need to be encrufted with NOTREACHED.  It's too bad
  that only gcc understands the declaration.

Asked by:	bde@
2003-06-09 19:21:35 +00:00
Philippe Charnier
5288a06a91 Add NOTREACHED after err() inside of a switch statement. 2003-06-08 13:39:32 +00:00
Alfred Perlstein
da8de1e204 WARNS=4 2002-07-14 18:23:22 +00:00
Philippe Charnier
3898680cf7 Use `The .Nm utility' 2002-04-19 23:44:58 +00:00
Mark Murray
ed74761863 Minor whitespace nit. 2002-03-23 15:20:45 +00:00
Mark Murray
91bd71d206 Remove leaf node WARNS?=2 (that mainly I added). This should
help the GCC3 transition and CURRENT in general.
2002-02-08 22:31:43 +00:00
David Malone
9f5b04e925 Style improvements recommended by Bruce as a follow up to some
of the recent WARNS commits. The idea is:

1) FreeBSD id tags should follow vendor tags.
2) Vendor tags should not be compiled (though copyrights probably should).
3) There should be no blank line between including cdefs and __FBSDIF.
2001-12-10 21:13:08 +00:00
Mark Murray
4100f6cb7d Use __FBSDID(). 2001-12-02 20:40:22 +00:00
Brian Somers
08741a6f5c Revert to version 1.16 which was more correct than either of my attempts. 2001-08-21 12:54:15 +00:00
Brian Somers
051449d576 Remove unnecessary casts.
The original (1.16) code was mostly correct, but this version is
far clearer.

Casts suggested to now be obfuscations by: bde
2001-08-21 11:24:53 +00:00
Brian Somers
cbe1d3b630 Handle snprintf() returning -1.
MFC after:	2 weeks
2001-08-20 14:46:40 +00:00
Dima Dorfman
f247324df7 Remove whitespace at EOL. 2001-07-15 08:06:20 +00:00
Ruslan Ermilov
625003720a mdoc(7) police: removed HISTORY info from the .Os call. 2001-07-10 14:16:33 +00:00
Brian Somers
7bc6d0158f Fix the type of the NULL arg to execl()
Idea from: Theo de Raadt <deraadt@openbsd.org>
2001-07-09 09:24:06 +00:00
Dima Dorfman
982f5d88ff WARNS= -> WARNS?=
Submitted by:	Mike Barcroft <mike@q9media.com>
2001-06-22 21:38:30 +00:00
Kris Kennaway
1a93d71ebc This passes WARNS=2 on alpha and i386 2001-05-20 06:15:09 +00:00
Will Andrews
34bc43d532 Fix bogus checking of snprintf() by decreasing the remaining size of the
string after each successful snprintf() call.  This makes apply(1) work
*correctly*, although the whole snprintf() deal really should be redone.

Bug noted by:	nectar (about 3 weeks ago)
2001-01-25 03:40:17 +00:00
Will Andrews
cdc8ffbbac Fix numerous style(9) bugs: Put #define's before declarations; sort the
declarations & their arguments; use only one tab after types; restore the
type of argv to sync with src tree style; sort new variables under main();
fix continuation indents; remove extra blank line before free()'s.  Still
to do: fix snprintf() handling as nectar & bde suggested to me.

Submitted by:	bde
2001-01-21 08:37:35 +00:00
Will Andrews
f697348034 Reinstate revision 1.11:
BDECFLAGS; ANSIfy; use EXEC instead of "exec " where appropriate; use
proper types (size_t, int); use proper variable names for certain things;
get rid of static 'cache' style stuff by moving and sanitizing the
original SHELL checking code to main(), this also makes it easier to
free() the string; rename file-scope system() to exec_shell(); use
snprintf() everywhere instead of sprintf(); actually remember to free()
other malloc()'d char pointers in main().

I left out the -s option in this revision along with getusershell()
checking because of objections made by Warner Losh <imp> and Garrett
Wollman <wollman>.  I agreed with their assertions that such code was
unnecessary in a program like this.

I dare people to make this coredump now.

Some suggestions:	nectar (snprintf() truncate checking)
Reviewed by:		markm, eivind, jedgar
Tortured by:		examples in apply(1), fuzz(1),
			and a lot of random ideas I came up with
2001-01-05 18:15:17 +00:00
Will Andrews
9861e6df73 Back out last commit; it had string function mistakes. I will fix this
and make sure it works next time.

Submitted by:	markm, jhb
2001-01-04 20:11:09 +00:00
Will Andrews
fbd7649d29 Document new -s option: pass a shell to apply(1) when the desired shell
isn't found in /etc/shells.
2001-01-04 19:28:34 +00:00
Will Andrews
c494ed80cd BDECFLAGS; de-__P()-ify, ANSIfy, use snprintf() instead of sprintf(),
especially on strings passed from argv; rename system() to exec_shell(),
and make it static; use strlcpy() and make sure it works; use proper
type (size_t) to be passed to malloc()/realloc().

Use getusershell() to make sure the SHELL environment variable passed is
safe to use.  Add new option -s to allow anal users to pass things like
perl; this option is here along with getusershell() checking since the
such checking is only intended to affect things like suidperl that might
call apply(1).

Reviewed by:	markm, jhb, C. Stephen Gunn <csg@waterspout.com>
2001-01-04 19:05:49 +00:00
Ruslan Ermilov
8fe908ef0c mdoc(7) police: use the new features of the Nm macro. 2000-11-20 19:21:22 +00:00
Brian Somers
aab6541484 Include sys/types.h 2000-10-16 08:13:59 +00:00
Kris Kennaway
6ad135868c fork() -> vfork()
This would have been commit #2 which was "Obtained from: BSD/OS" except
their code is buggy (they call err() if the execl() fails, which will
incorrectly call exit()), so instead this is:

Obtained from:	NetBSD
2000-05-19 09:42:53 +00:00
Philippe Charnier
6ec34d218a Do not dot terminate errx() strings. Add rcsid.
Document -d flag. Rework SYNOPSIS section
1999-12-05 19:53:37 +00:00
Kris Kennaway
b26a5ea6fe Fix off-by-one error leading to a segfault.
Noticed by:	Thomas Stromberg <tstromberg@rtci.com>
1999-12-04 02:19:33 +00:00
Peter Wemm
c3aac50f28 $Id$ -> $FreeBSD$ 1999-08-28 01:08:13 +00:00
Nik Clayton
3be5f1f5ce Add $Id$, to make it simpler for members of the translation teams to
track.

The $Id$ line is normally at the bottom of the main comment block in the
man page, separated from the rest of the manpage by an empty comment,
like so;

     .\"    $Id$
     .\"

If the immediately preceding comment is a @(#) format ID marker than the
the $Id$ will line up underneath it with no intervening blank lines.
Otherwise, an additional blank line is inserted.

Approved by:            bde
1999-07-12 20:24:20 +00:00
Eivind Eklund
bc64b31886 Merge from OpenBSD up to rev 1.7 (matches NetBSD rev 1.4):
Misc small cleanups.
1999-02-12 15:06:55 +00:00
Eivind Eklund
ec10002d16 Merge from OpenBSD up to rev 1.5 (matches NetBSD up to rev 1.3):
* Clean up waitpid parameter handling.
1999-02-12 14:42:31 +00:00
Archie Cobbs
fa146c5335 Tweaks to allow compiling -Wall (mostly adding "const" to char rcsid[]). 1998-12-06 22:58:23 +00:00
Dag-Erling Smørgrav
1fd98d7d88 Calls one or more of malloc(), warn(), err(), syslog(), execlp() or
execvp() in the child branch of a vfork(). Changed to use fork()
instead.

Some of these (mv, find, apply, xargs) might benefit greatly from
being rewritten to use vfork() properly.

PR:		Loosely related to bin/8252
Approved by:	jkh and bde
1998-10-13 14:52:33 +00:00
Poul-Henning Kamp
84717b42e8 .Sh ENVIRONMENT VARIABLES -> .Sh ENVIRONMENT
PR:		6599
Reviewed by:	phk
Submitted by:	Josh Gilliam <josh@quick.net>
1998-05-13 07:57:49 +00:00
Philippe Charnier
306005e78c .Sh AUTHOR -> .Sh AUTHORS. Use .An/.Aq. 1998-03-23 07:48:45 +00:00
Warner Losh
1c8af87873 compare return value from getopt against -1 rather than EOF, per the final
posix standard on the topic.
1997-03-29 04:34:07 +00:00
Mike Pritchard
4aabdf7d3b Change an incorrect reference to the "-n" flag to "-#".
Submitted by:	Masanobu Saitoh <msaitoh@spa.is.uec.ac.jp>
Obtained from: NetBSD-bugs mailing list
1996-03-11 03:09:00 +00:00
Rodney W. Grimes
7799f52a32 Remove trailing whitespace. 1995-05-30 06:41:30 +00:00
Rodney W. Grimes
9b50d90275 BSD 4.4 Lite Usr.bin Sources 1994-05-27 12:33:43 +00:00