summaryrefslogtreecommitdiffstats
path: root/bin/sh/alias.c
Commit message (Collapse)AuthorAgeFilesLines
* sh: Don't hash alias name when there are no aliases.jilles2016-02-211-2/+4
|
* sh: Fix some arithmetic undefined behaviour.jilles2015-06-241-1/+1
| | | | | | | Fix shifts of possibly negative numbers found with ubsan and avoid signed integer overflow when hashing an extremely long command name. MFC after: 1 week
* sh: Fix possible memory leaks and double frees with unexpected SIGINT.jilles2014-03-261-1/+6
|
* sh: Solve the alias recursion problem in a less hackish way.jilles2014-01-241-44/+0
| | | | | | | | | Add the space to avoid alias recursion when the alias is expanded, not when it is added. As a result, displaying an alias via command -v, command -V or type no longer erroneously appends a space. Adjust the tests so they now require this bug to be absent.
* sh: Recognize "--" as end of options in alias builtin.jilles2013-08-251-3/+5
| | | | | Aliases starting with "-" (which are non-POSIX) will need to be preceded by an alias not starting with "-" or the newly added "--".
* sh: Fix two issues when an alias is redefined:jilles2012-11-081-0/+11
| | | | | | | | | | | | | * The last character is not displayed. * If the alias ends with itself (as a word), an infinite memory-eating loop occurs. If an alias is defined initially, a space is appended to avoid recursion but this did not happen when an alias was later modified. PR: bin/173418 Submitted by: Daniel F. MFC after: 1 week
* sh: Fix duplicate prototypes for builtins.jilles2011-06-131-0/+1
| | | | | | Have mkbuiltins write the prototypes for the *cmd functions to builtins.h instead of builtins.c and include builtins.h in more .c files instead of duplicating prototypes for *cmd functions in other headers.
* sh: Reduce more needless differences between error messages.jilles2011-06-041-1/+1
|
* sh: Remove special code for shell scripts without magic number.jilles2011-02-041-9/+1
| | | | | | | | | | These are called "shell procedures" in the source. If execve() failed with [ENOEXEC], the shell would reinitialize itself and execute the program as a script. This requires a fair amount of code which is not frequently used (most scripts have a #! magic number). Therefore just execute a new instance of sh (_PATH_BSHELL) to run the script.
* sh: Add a function to print warnings (with command name and newline).jilles2010-12-211-1/+1
| | | | | | This is like error() but without raising an exception. It is particularly useful as a replacement for the warnx macro in bltin/bltin.h.
* In the spirit of r90111, depend on c89 and remove the "STATIC" macroobrien2010-10-131-9/+9
| | | | and its usage.
* Consistently use "STATIC" for all functions in order to be able to setobrien2010-10-131-5/+5
| | | | | | breakpoints with in a debugger. And use naked "static" for variables. Noticed by: bde
* sh: Constify various strings.jilles2009-12-241-3/+3
| | | | | Most of this is adding const keywords, but setvar() in var.c had to be changed somewhat more.
* be more type correct and align local ckmalloc() with its underlying ↵rse2009-06-011-1/+1
| | | | malloc(3) by using a "size_t" instead of an "int" argument
* - Apply the r190270 changes to printing of single aliases too.stefanf2009-03-221-23/+48
| | | | - Sort the aliases before printing them.
* Make the output of the alias built-in POSIX-compliant: Drop the leading 'alias'stefanf2009-03-221-1/+6
| | | | and suppress printing the trailing space which is added for internal purposes.
* use 'const' for the parameters of the two static functions unalias() and ↵rse2008-06-071-4/+4
| | | | hashalias()
* remove an unnecessary includerse2008-06-071-1/+0
|
* Return 1 from the unalias builtin if _any_ removal fails, not just the laststefanf2005-09-021-1/+1
| | | | one.
* Use prototypes in the MKINIT lines collected by mkinit.stefanf2005-08-131-1/+1
|
* Remove clause 3 from the UCB licenses.markm2004-04-061-4/+0
| | | | OK'ed by: imp, core
* Changes following CScout analysis:dds2003-07-051-1/+1
| | | | | | | | | | | - Removed dead declarations - Made objects that should have been declared as static, static. The changes use STATIC instead of static, following the existing convention in the rest of the code. Approved by: schweikh (mentor) MFC after: 2 weeks
* Consistently use FBSDIDobrien2002-06-301-2/+2
|
* Quote alias values in the output of the alias(1) builtin so they aretjr2002-06-041-4/+10
| | | | suitable for re-input to the shell (SUSv3)
* o __P has been reovedimp2002-02-021-21/+13
| | | | | | | | | | | | | | | | | | o Old-style K&R declarations have been converted to new C89 style o register has been removed o prototype for main() has been removed (gcc3 makes it an error) o int main(int argc, char *argv[]) is the preferred main definition. o Attempt to not break style(9) conformance for declarations more than they already are. o Change int foo() { ... to int foo(void) { ...
* Fixd with alias missing.sada2000-07-151-0/+1
| | | | | PR: bin/19475 Approved by: Martin Cracauer <cracauer@cons.org> (with conditions)
* $Id$ -> $FreeBSD$peter1999-08-271-1/+1
|
* Various spelling/formatting changes.kris1999-05-081-2/+2
| | | | Submitted by: Philippe Charnier <charnier@xp11.frmug.org>
* Add rcsid. Spelling.charnier1998-05-181-3/+5
|
* Use the __unused attribute where warranted.steve1997-05-191-3/+3
|
* Nuke register keyword usage and #if -> #ifdef.steve1997-04-281-2/+2
| | | | Obtained from: NetBSD
* Revert $FreeBSD$ to $Id$peter1997-02-221-1/+1
|
* Make the long-awaited change from $Id$ to $FreeBSD$jkh1997-01-141-1/+1
| | | | | | | | This will make a number of things easier in the future, as well as (finally!) avoiding the Id-smashing problem which has plagued developers for so long. Boy, I'm glad we're not using sup anymore. This update would have been insane otherwise.
* Merge in NetBSD mods and -Wall cleaning.steve1996-12-141-2/+2
| | | | Obtained from: NetBSD, me
* Merge of 4.4-Lite2 sh source, plus some gcc -Wall cleaning. This is apeter1996-09-011-8/+17
| | | | | | | | | | | | | | merge of parallel duplicate work by Steve Price and myself. :-] There are some changes to the build that are my fault... mkinit.c was trying (poorly) to duplicate some of the work that make(1) is designed to do. The Makefile hackery is my fault too, the depend list was incomplete because of some explicit OBJS+= entries, so mkdep wasn't picking up their source file #includes. This closes a pile of /bin/sh PR's, but not all of them.. Submitted by: Steve Price <steve@bonsai.hiwaay.net>, peter
* Remove trailing whitespace.rgrimes1995-05-301-2/+2
| | | | Reviewed by: phk
* Added $Id$dg1994-09-241-0/+2
|
* BSD 4.4 Lite bin Sourcesrgrimes1994-05-261-0/+251
OpenPOWER on IntegriCloud