aboutsummaryrefslogtreecommitdiffstats
path: root/alias.c
diff options
context:
space:
mode:
authorJari Aalto <jari.aalto@cante.net>2000-03-17 21:46:59 +0000
committerJari Aalto <jari.aalto@cante.net>2009-09-12 16:46:53 +0000
commitbb70624e964126b7ac4ff085ba163a9c35ffa18f (patch)
treeba2dd4add13ada94b1899c6d4aca80195b80b74b /alias.c
parentb72432fdcc59300c6fe7c9d6c8a31ad3447933f5 (diff)
downloadandroid_external_bash-bb70624e964126b7ac4ff085ba163a9c35ffa18f.tar.gz
android_external_bash-bb70624e964126b7ac4ff085ba163a9c35ffa18f.tar.bz2
android_external_bash-bb70624e964126b7ac4ff085ba163a9c35ffa18f.zip
Imported from ../bash-2.04.tar.gz.
Diffstat (limited to 'alias.c')
-rw-r--r--alias.c32
1 files changed, 23 insertions, 9 deletions
diff --git a/alias.c b/alias.c
index 13b7f57..183fe27 100644
--- a/alias.c
+++ b/alias.c
@@ -7,7 +7,7 @@
Bash is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 1, or (at your option)
+ the Free Software Foundation; either version 2, or (at your option)
any later version.
Bash is distributed in the hope that it will be useful, but WITHOUT
@@ -17,7 +17,7 @@
You should have received a copy of the GNU General Public License
along with Bash; see the file COPYING. If not, write to the Free
- Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
+ Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#include "config.h"
@@ -37,6 +37,10 @@
#include "externs.h"
#include "alias.h"
+#if defined (PROGRAMMABLE_COMPLETION)
+# include "pcomplete.h"
+#endif
+
static int qsort_alias_compare ();
/* Non-zero means expand all words on the line. Otherwise, expand
@@ -121,6 +125,9 @@ add_alias (name, value)
elt = add_hash_item (savestring (name), aliases);
elt->data = (char *)temp;
+#if defined (PROGRAMMABLE_COMPLETION)
+ set_itemlist_dirty (&it_aliases);
+#endif
}
}
@@ -155,6 +162,9 @@ remove_alias (name)
free_alias_data (elt->data);
free (elt->key); /* alias name */
free (elt); /* XXX */
+#if defined (PROGRAMMABLE_COMPLETION)
+ set_itemlist_dirty (&it_aliases);
+#endif
return (aliases->nentries);
}
return (-1);
@@ -170,6 +180,9 @@ delete_all_aliases ()
flush_hash_table (aliases, free_alias_data);
dispose_hash_table (aliases);
aliases = (HASH_TABLE *)NULL;
+#if defined (PROGRAMMABLE_COMPLETION)
+ set_itemlist_dirty (&it_aliases);
+#endif
}
/* Return an array of aliases that satisfy the conditions tested by FUNCTION.
@@ -433,21 +446,22 @@ char *
alias_expand (string)
char *string;
{
- int line_len = 1 + strlen (string);
- char *line = (char *)xmalloc (line_len);
register int i, j, start;
- char *token = xmalloc (line_len);
- int tl, real_start, expand_next, expand_this_token;
+ char *line, *token;
+ int line_len, tl, real_start, expand_next, expand_this_token;
alias_t *alias;
+ line_len = strlen (string) + 1;
+ line = xmalloc (line_len);
+ token = xmalloc (line_len);
+
line[0] = i = 0;
expand_next = 0;
command_word = 1; /* initialized to expand the first word on the line */
/* Each time through the loop we find the next word in line. If it
- has an alias, substitute
- the alias value. If the value ends in ` ', then try again
- with the next word. Else, if there is no value, or if
+ has an alias, substitute the alias value. If the value ends in ` ',
+ then try again with the next word. Else, if there is no value, or if
the value does not end in space, we are done. */
for (;;)