summaryrefslogtreecommitdiffstats
path: root/usr.bin/apply/apply.c
Commit message (Collapse)AuthorAgeFilesLines
* Constify arguments. While I'm there, also add a static for usage().delphij2013-01-041-3/+3
| | | | MFC after: 2 weeks
* Remove the advertising clause from UCB copyrighted files in usr.bin. Thisjoel2010-12-111-4/+0
| | | | | | | | | 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
* - Use errx(3) instead of err(3) when checking if snprintf(3) succeeded.jh2010-03-051-35/+32
| | | | | | | | | | 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
* Revert previous commit, from Bruce:charnier2003-06-091-1/+0
| | | | | | | | 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@
* Add NOTREACHED after err() inside of a switch statement.charnier2003-06-081-0/+1
|
* WARNS=4alfred2002-07-141-1/+1
|
* Style improvements recommended by Bruce as a follow up to somedwmalone2001-12-101-5/+6
| | | | | | | | 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.
* Use __FBSDID().markm2001-12-021-5/+4
|
* Revert to version 1.16 which was more correct than either of my attempts.brian2001-08-211-4/+4
|
* Remove unnecessary casts.brian2001-08-211-4/+4
| | | | | | | The original (1.16) code was mostly correct, but this version is far clearer. Casts suggested to now be obfuscations by: bde
* Handle snprintf() returning -1.brian2001-08-201-4/+4
| | | | MFC after: 2 weeks
* Fix the type of the NULL arg to execl()brian2001-07-091-1/+1
| | | | Idea from: Theo de Raadt <deraadt@openbsd.org>
* Fix bogus checking of snprintf() by decreasing the remaining size of thewill2001-01-251-0/+3
| | | | | | | 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)
* Fix numerous style(9) bugs: Put #define's before declarations; sort thewill2001-01-211-12/+11
| | | | | | | | | 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
* Reinstate revision 1.11:will2001-01-051-37/+62
| | | | | | | | | | | | | | | | | | | | | | 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
* Back out last commit; it had string function mistakes. I will fix thiswill2001-01-041-40/+23
| | | | | | and make sure it works next time. Submitted by: markm, jhb
* BDECFLAGS; de-__P()-ify, ANSIfy, use snprintf() instead of sprintf(),will2001-01-041-23/+40
| | | | | | | | | | | | | | 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>
* Include sys/types.hbrian2000-10-161-0/+2
|
* fork() -> vfork()kris2000-05-191-3/+4
| | | | | | | | 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
* Do not dot terminate errx() strings. Add rcsid.charnier1999-12-051-3/+3
| | | | Document -d flag. Rework SYNOPSIS section
* Fix off-by-one error leading to a segfault.kris1999-12-041-1/+5
| | | | Noticed by: Thomas Stromberg <tstromberg@rtci.com>
* Merge from OpenBSD up to rev 1.5 (matches NetBSD up to rev 1.3):eivind1999-02-121-4/+3
| | | | * Clean up waitpid parameter handling.
* Tweaks to allow compiling -Wall (mostly adding "const" to char rcsid[]).archie1998-12-061-1/+1
|
* Calls one or more of malloc(), warn(), err(), syslog(), execlp() ordes1998-10-131-1/+1
| | | | | | | | | | | 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
* compare return value from getopt against -1 rather than EOF, per the finalimp1997-03-291-1/+1
| | | | posix standard on the topic.
* Remove trailing whitespace.rgrimes1995-05-301-1/+1
|
* BSD 4.4 Lite Usr.bin Sourcesrgrimes1994-05-271-0/+234
OpenPOWER on IntegriCloud