mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-07-03 02:10:50 +02:00
commit bash-20130830 snapshot
This commit is contained in:
@@ -5217,3 +5217,22 @@ bashline.c
|
||||
to look up in $PATH (absolute_program(*name) != 0), just call the
|
||||
usual bash_filename_stat_hook and return those results. This makes
|
||||
completions like $PWD/exam[TAB] add a trailing slash
|
||||
|
||||
9/2
|
||||
---
|
||||
builtins/read.def
|
||||
- read_builtin: before comparing what we read to the delim, make sure
|
||||
we are not supposed to be ignoring the delimiter (read -N). We
|
||||
set the delim to -1, but it's possible to read a character whose
|
||||
int value ends up being between -1 and -128. Fixes bug
|
||||
reported by Stephane Chazelas <stephane.chazelas@gmail.com>
|
||||
|
||||
doc/{bash.1,bashref.texi}
|
||||
- word splitting: crib some language from Posix to make it clear that
|
||||
characters in IFS are treated as field *terminators*, not field
|
||||
*separators*. Addresses issue raised by DJ Mills
|
||||
<danielmills1@gmail.com>
|
||||
|
||||
lib/readline/{util.c,rldefs.h}
|
||||
- _rl_stricmp,_rl_strnicmp: now take const char * string arguments;
|
||||
changed prototype declarations
|
||||
|
||||
@@ -5211,3 +5211,24 @@ pcomplete.c
|
||||
- pcomp_filename_completion_function: make sure rl_filename_dequoting_function
|
||||
is non-NULL before trying to call it. Bug and fix from
|
||||
Andreas Schwab <schwab@linux-m68k.org>
|
||||
|
||||
bashline.c
|
||||
- bash_command_name_stat_hook: if *name is not something we're going
|
||||
to look up in $PATH (absolute_program(*name) != 0), just call the
|
||||
usual bash_filename_stat_hook and return those results. This makes
|
||||
completions like $PWD/exam[TAB] add a trailing slash
|
||||
|
||||
9/2
|
||||
---
|
||||
builtins/read.def
|
||||
- read_builtin: before comparing what we read to the delim, make sure
|
||||
we are not supposed to be ignoring the delimiter (read -N). We
|
||||
set the delim to -1, but it's possible to read a character whose
|
||||
int value ends up being between -1 and -128. Fixes bug
|
||||
reported by Stephane Chazelas <stephane.chazelas@gmail.com>
|
||||
|
||||
doc/{bash.1,bashref.texi}
|
||||
- word splitting: crib some language from Posix to make it clear that
|
||||
characters in IFS are treated as field *terminators*, not field
|
||||
*separators*. Addresses issue raised by DJ Mills
|
||||
<danielmills1@gmail.com>
|
||||
|
||||
+1
-1
@@ -639,7 +639,7 @@ read_builtin (list)
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((unsigned char)c == delim)
|
||||
if (ignore_delim == 0 && (unsigned char)c == delim)
|
||||
break;
|
||||
|
||||
if (c == '\0' && delim != '\0')
|
||||
|
||||
+1091
File diff suppressed because it is too large
Load Diff
+4
-3
@@ -5,12 +5,12 @@
|
||||
.\" Case Western Reserve University
|
||||
.\" chet@po.cwru.edu
|
||||
.\"
|
||||
.\" Last Change: Tue Aug 6 09:55:50 EDT 2013
|
||||
.\" Last Change: Mon Sep 2 12:21:48 EDT 2013
|
||||
.\"
|
||||
.\" bash_builtins, strip all but Built-Ins section
|
||||
.if \n(zZ=1 .ig zZ
|
||||
.if \n(zY=1 .ig zY
|
||||
.TH BASH 1 "2013 August 6" "GNU Bash 4.3"
|
||||
.TH BASH 1 "2013 September 2" "GNU Bash 4.3"
|
||||
.\"
|
||||
.\" There's some problem with having a `@'
|
||||
.\" in a tagged paragraph with the BSD man macros.
|
||||
@@ -3194,7 +3194,8 @@ The shell treats each character of
|
||||
.SM
|
||||
.B IFS
|
||||
as a delimiter, and splits the results of the other
|
||||
expansions into words on these characters. If
|
||||
expansions into words using these characters as field terminators.
|
||||
If
|
||||
.SM
|
||||
.B IFS
|
||||
is unset, or its
|
||||
|
||||
+10307
File diff suppressed because it is too large
Load Diff
+2
-1
@@ -2267,7 +2267,8 @@ and arithmetic expansion that did not occur within double quotes for
|
||||
word splitting.
|
||||
|
||||
The shell treats each character of @env{$IFS} as a delimiter, and splits
|
||||
the results of the other expansions into words on these characters.
|
||||
the results of the other expansions into words using these characters
|
||||
as field terminators.
|
||||
If @env{IFS} is unset, or its value is exactly @code{<space><tab><newline>},
|
||||
the default, then sequences of
|
||||
@code{ <space>}, @code{<tab>}, and @code{<newline>}
|
||||
|
||||
+8719
File diff suppressed because it is too large
Load Diff
+3
-3
@@ -2,9 +2,9 @@
|
||||
Copyright (C) 1988-2013 Free Software Foundation, Inc.
|
||||
@end ignore
|
||||
|
||||
@set LASTCHANGE Tue Aug 6 09:56:12 EDT 2013
|
||||
@set LASTCHANGE Mon Sep 2 12:21:28 EDT 2013
|
||||
|
||||
@set EDITION 4.3
|
||||
@set VERSION 4.3
|
||||
@set UPDATED 6 August 2013
|
||||
@set UPDATED-MONTH August 2013
|
||||
@set UPDATED 2 September 2013
|
||||
@set UPDATED-MONTH September 2013
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
@ignore
|
||||
Copyright (C) 1988-2013 Free Software Foundation, Inc.
|
||||
@end ignore
|
||||
|
||||
@set LASTCHANGE Tue Aug 6 09:56:12 EDT 2013
|
||||
|
||||
@set EDITION 4.3
|
||||
@set VERSION 4.3
|
||||
@set UPDATED 6 August 2013
|
||||
@set UPDATED-MONTH August 2013
|
||||
@@ -79,8 +79,8 @@ extern char *strchr (), *strrchr ();
|
||||
#define _rl_stricmp strcasecmp
|
||||
#define _rl_strnicmp strncasecmp
|
||||
#else
|
||||
extern int _rl_stricmp PARAMS((char *, char *));
|
||||
extern int _rl_strnicmp PARAMS((char *, char *, int));
|
||||
extern int _rl_stricmp PARAMS((const char *, const char *));
|
||||
extern int _rl_strnicmp PARAMS((const char *, const char *, int));
|
||||
#endif
|
||||
|
||||
#if defined (HAVE_STRPBRK) && !defined (HAVE_MULTIBYTE)
|
||||
|
||||
@@ -0,0 +1,166 @@
|
||||
/* rldefs.h -- an attempt to isolate some of the system-specific defines
|
||||
for readline. This should be included after any files that define
|
||||
system-specific constants like _POSIX_VERSION or USG. */
|
||||
|
||||
/* Copyright (C) 1987-2011 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of the GNU Readline Library (Readline), a library
|
||||
for reading lines of text with interactive input and history editing.
|
||||
|
||||
Readline 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 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Readline is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Readline. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#if !defined (_RLDEFS_H_)
|
||||
#define _RLDEFS_H_
|
||||
|
||||
#if defined (HAVE_CONFIG_H)
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include "rlstdc.h"
|
||||
|
||||
#if defined (STRCOLL_BROKEN)
|
||||
# undef HAVE_STRCOLL
|
||||
#endif
|
||||
|
||||
#if defined (_POSIX_VERSION) && !defined (TERMIOS_MISSING)
|
||||
# define TERMIOS_TTY_DRIVER
|
||||
#else
|
||||
# if defined (HAVE_TERMIO_H)
|
||||
# define TERMIO_TTY_DRIVER
|
||||
# else
|
||||
# if !defined (__MINGW32__)
|
||||
# define NEW_TTY_DRIVER
|
||||
# else
|
||||
# define NO_TTY_DRIVER
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Posix macro to check file in statbuf for directory-ness.
|
||||
This requires that <sys/stat.h> be included before this test. */
|
||||
#if defined (S_IFDIR) && !defined (S_ISDIR)
|
||||
# define S_ISDIR(m) (((m)&S_IFMT) == S_IFDIR)
|
||||
#endif
|
||||
|
||||
/* Decide which flavor of the header file describing the C library
|
||||
string functions to include and include it. */
|
||||
|
||||
#if defined (HAVE_STRING_H)
|
||||
# include <string.h>
|
||||
#else /* !HAVE_STRING_H */
|
||||
# include <strings.h>
|
||||
#endif /* !HAVE_STRING_H */
|
||||
|
||||
#if !defined (strchr) && !defined (__STDC__)
|
||||
extern char *strchr (), *strrchr ();
|
||||
#endif /* !strchr && !__STDC__ */
|
||||
|
||||
#if defined (PREFER_STDARG)
|
||||
# include <stdarg.h>
|
||||
#else
|
||||
# if defined (PREFER_VARARGS)
|
||||
# include <varargs.h>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined (HAVE_STRCASECMP)
|
||||
#define _rl_stricmp strcasecmp
|
||||
#define _rl_strnicmp strncasecmp
|
||||
#else
|
||||
extern int _rl_stricmp PARAMS((char *, char *));
|
||||
extern int _rl_strnicmp PARAMS((char *, char *, int));
|
||||
#endif
|
||||
|
||||
#if defined (HAVE_STRPBRK) && !defined (HAVE_MULTIBYTE)
|
||||
# define _rl_strpbrk(a,b) strpbrk((a),(b))
|
||||
#else
|
||||
extern char *_rl_strpbrk PARAMS((const char *, const char *));
|
||||
#endif
|
||||
|
||||
#if !defined (emacs_mode)
|
||||
# define no_mode -1
|
||||
# define vi_mode 0
|
||||
# define emacs_mode 1
|
||||
#endif
|
||||
|
||||
#if !defined (RL_IM_INSERT)
|
||||
# define RL_IM_INSERT 1
|
||||
# define RL_IM_OVERWRITE 0
|
||||
#
|
||||
# define RL_IM_DEFAULT RL_IM_INSERT
|
||||
#endif
|
||||
|
||||
/* If you cast map[key].function to type (Keymap) on a Cray,
|
||||
the compiler takes the value of map[key].function and
|
||||
divides it by 4 to convert between pointer types (pointers
|
||||
to functions and pointers to structs are different sizes).
|
||||
This is not what is wanted. */
|
||||
#if defined (CRAY)
|
||||
# define FUNCTION_TO_KEYMAP(map, key) (Keymap)((int)map[key].function)
|
||||
# define KEYMAP_TO_FUNCTION(data) (rl_command_func_t *)((int)(data))
|
||||
#else
|
||||
# define FUNCTION_TO_KEYMAP(map, key) (Keymap)(map[key].function)
|
||||
# define KEYMAP_TO_FUNCTION(data) (rl_command_func_t *)(data)
|
||||
#endif
|
||||
|
||||
#ifndef savestring
|
||||
#define savestring(x) strcpy ((char *)xmalloc (1 + strlen (x)), (x))
|
||||
#endif
|
||||
|
||||
/* Possible values for _rl_bell_preference. */
|
||||
#define NO_BELL 0
|
||||
#define AUDIBLE_BELL 1
|
||||
#define VISIBLE_BELL 2
|
||||
|
||||
/* Definitions used when searching the line for characters. */
|
||||
/* NOTE: it is necessary that opposite directions are inverses */
|
||||
#define FTO 1 /* forward to */
|
||||
#define BTO -1 /* backward to */
|
||||
#define FFIND 2 /* forward find */
|
||||
#define BFIND -2 /* backward find */
|
||||
|
||||
/* Possible values for the found_quote flags word used by the completion
|
||||
functions. It says what kind of (shell-like) quoting we found anywhere
|
||||
in the line. */
|
||||
#define RL_QF_SINGLE_QUOTE 0x01
|
||||
#define RL_QF_DOUBLE_QUOTE 0x02
|
||||
#define RL_QF_BACKSLASH 0x04
|
||||
#define RL_QF_OTHER_QUOTE 0x08
|
||||
|
||||
/* Default readline line buffer length. */
|
||||
#define DEFAULT_BUFFER_SIZE 256
|
||||
|
||||
#if !defined (STREQ)
|
||||
#define STREQ(a, b) (((a)[0] == (b)[0]) && (strcmp ((a), (b)) == 0))
|
||||
#define STREQN(a, b, n) (((n) == 0) ? (1) \
|
||||
: ((a)[0] == (b)[0]) && (strncmp ((a), (b), (n)) == 0))
|
||||
#endif
|
||||
|
||||
#if !defined (RL_STRLEN)
|
||||
# define RL_STRLEN(s) (((s) && (s)[0]) ? ((s)[1] ? ((s)[2] ? strlen(s) : 2) : 1) : 0)
|
||||
#endif
|
||||
|
||||
#if !defined (FREE)
|
||||
# define FREE(x) if (x) free (x)
|
||||
#endif
|
||||
|
||||
#if !defined (SWAP)
|
||||
# define SWAP(s, e) do { int t; t = s; s = e; e = t; } while (0)
|
||||
#endif
|
||||
|
||||
/* CONFIGURATION SECTION */
|
||||
#include "rlconf.h"
|
||||
|
||||
#endif /* !_RLDEFS_H_ */
|
||||
+10
-6
@@ -373,11 +373,13 @@ _rl_strpbrk (string1, string2)
|
||||
doesn't matter (strncasecmp). */
|
||||
int
|
||||
_rl_strnicmp (string1, string2, count)
|
||||
char *string1, *string2;
|
||||
const char *string1;
|
||||
const char *string2;
|
||||
int count;
|
||||
{
|
||||
register char *s1, *s2;
|
||||
int d;
|
||||
register const char *s1;
|
||||
register const char *s2;
|
||||
register int d;
|
||||
|
||||
if (count <= 0 || (string1 == string2))
|
||||
return 0;
|
||||
@@ -401,10 +403,12 @@ _rl_strnicmp (string1, string2, count)
|
||||
/* strcmp (), but caseless (strcasecmp). */
|
||||
int
|
||||
_rl_stricmp (string1, string2)
|
||||
char *string1, *string2;
|
||||
const char *string1;
|
||||
const char *string2;
|
||||
{
|
||||
register char *s1, *s2;
|
||||
int d;
|
||||
register const char *s1;
|
||||
register const char *s2;
|
||||
register int d;
|
||||
|
||||
s1 = string1;
|
||||
s2 = string2;
|
||||
|
||||
@@ -0,0 +1,587 @@
|
||||
/* util.c -- readline utility functions */
|
||||
|
||||
/* Copyright (C) 1987-2012 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of the GNU Readline Library (Readline), a library
|
||||
for reading lines of text with interactive input and history editing.
|
||||
|
||||
Readline 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 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Readline is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Readline. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#define READLINE_LIBRARY
|
||||
|
||||
#if defined (HAVE_CONFIG_H)
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <fcntl.h>
|
||||
#include "posixjmp.h"
|
||||
|
||||
#if defined (HAVE_UNISTD_H)
|
||||
# include <unistd.h> /* for _POSIX_VERSION */
|
||||
#endif /* HAVE_UNISTD_H */
|
||||
|
||||
#if defined (HAVE_STDLIB_H)
|
||||
# include <stdlib.h>
|
||||
#else
|
||||
# include "ansi_stdlib.h"
|
||||
#endif /* HAVE_STDLIB_H */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
|
||||
/* System-specific feature definitions and include files. */
|
||||
#include "rldefs.h"
|
||||
#include "rlmbutil.h"
|
||||
|
||||
#if defined (TIOCSTAT_IN_SYS_IOCTL)
|
||||
# include <sys/ioctl.h>
|
||||
#endif /* TIOCSTAT_IN_SYS_IOCTL */
|
||||
|
||||
/* Some standard library routines. */
|
||||
#include "readline.h"
|
||||
|
||||
#include "rlprivate.h"
|
||||
#include "xmalloc.h"
|
||||
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
/* Utility Functions */
|
||||
/* */
|
||||
/* **************************************************************** */
|
||||
|
||||
/* Return 0 if C is not a member of the class of characters that belong
|
||||
in words, or 1 if it is. */
|
||||
|
||||
int _rl_allow_pathname_alphabetic_chars = 0;
|
||||
static const char * const pathname_alphabetic_chars = "/-_=~.#$";
|
||||
|
||||
int
|
||||
rl_alphabetic (c)
|
||||
int c;
|
||||
{
|
||||
if (ALPHABETIC (c))
|
||||
return (1);
|
||||
|
||||
return (_rl_allow_pathname_alphabetic_chars &&
|
||||
strchr (pathname_alphabetic_chars, c) != NULL);
|
||||
}
|
||||
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
int
|
||||
_rl_walphabetic (wchar_t wc)
|
||||
{
|
||||
int c;
|
||||
|
||||
if (iswalnum (wc))
|
||||
return (1);
|
||||
|
||||
c = wc & 0177;
|
||||
return (_rl_allow_pathname_alphabetic_chars &&
|
||||
strchr (pathname_alphabetic_chars, c) != NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* How to abort things. */
|
||||
int
|
||||
_rl_abort_internal ()
|
||||
{
|
||||
rl_ding ();
|
||||
rl_clear_message ();
|
||||
_rl_reset_argument ();
|
||||
rl_clear_pending_input ();
|
||||
|
||||
RL_UNSETSTATE (RL_STATE_MACRODEF);
|
||||
while (rl_executing_macro)
|
||||
_rl_pop_executing_macro ();
|
||||
|
||||
rl_last_func = (rl_command_func_t *)NULL;
|
||||
#if defined (HAVE_POSIX_SIGSETJMP)
|
||||
siglongjmp (_rl_top_level, 1);
|
||||
#else
|
||||
longjmp (_rl_top_level, 1);
|
||||
#endif
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
rl_abort (count, key)
|
||||
int count, key;
|
||||
{
|
||||
return (_rl_abort_internal ());
|
||||
}
|
||||
|
||||
int
|
||||
_rl_null_function (count, key)
|
||||
int count, key;
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
rl_tty_status (count, key)
|
||||
int count, key;
|
||||
{
|
||||
#if defined (TIOCSTAT)
|
||||
ioctl (1, TIOCSTAT, (char *)0);
|
||||
rl_refresh_line (count, key);
|
||||
#else
|
||||
rl_ding ();
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Return a copy of the string between FROM and TO.
|
||||
FROM is inclusive, TO is not. */
|
||||
char *
|
||||
rl_copy_text (from, to)
|
||||
int from, to;
|
||||
{
|
||||
register int length;
|
||||
char *copy;
|
||||
|
||||
/* Fix it if the caller is confused. */
|
||||
if (from > to)
|
||||
SWAP (from, to);
|
||||
|
||||
length = to - from;
|
||||
copy = (char *)xmalloc (1 + length);
|
||||
strncpy (copy, rl_line_buffer + from, length);
|
||||
copy[length] = '\0';
|
||||
return (copy);
|
||||
}
|
||||
|
||||
/* Increase the size of RL_LINE_BUFFER until it has enough space to hold
|
||||
LEN characters. */
|
||||
void
|
||||
rl_extend_line_buffer (len)
|
||||
int len;
|
||||
{
|
||||
while (len >= rl_line_buffer_len)
|
||||
{
|
||||
rl_line_buffer_len += DEFAULT_BUFFER_SIZE;
|
||||
rl_line_buffer = (char *)xrealloc (rl_line_buffer, rl_line_buffer_len);
|
||||
}
|
||||
|
||||
_rl_set_the_line ();
|
||||
}
|
||||
|
||||
|
||||
/* A function for simple tilde expansion. */
|
||||
int
|
||||
rl_tilde_expand (ignore, key)
|
||||
int ignore, key;
|
||||
{
|
||||
register int start, end;
|
||||
char *homedir, *temp;
|
||||
int len;
|
||||
|
||||
end = rl_point;
|
||||
start = end - 1;
|
||||
|
||||
if (rl_point == rl_end && rl_line_buffer[rl_point] == '~')
|
||||
{
|
||||
homedir = tilde_expand ("~");
|
||||
_rl_replace_text (homedir, start, end);
|
||||
xfree (homedir);
|
||||
return (0);
|
||||
}
|
||||
else if (rl_line_buffer[start] != '~')
|
||||
{
|
||||
for (; !whitespace (rl_line_buffer[start]) && start >= 0; start--)
|
||||
;
|
||||
start++;
|
||||
}
|
||||
|
||||
end = start;
|
||||
do
|
||||
end++;
|
||||
while (whitespace (rl_line_buffer[end]) == 0 && end < rl_end);
|
||||
|
||||
if (whitespace (rl_line_buffer[end]) || end >= rl_end)
|
||||
end--;
|
||||
|
||||
/* If the first character of the current word is a tilde, perform
|
||||
tilde expansion and insert the result. If not a tilde, do
|
||||
nothing. */
|
||||
if (rl_line_buffer[start] == '~')
|
||||
{
|
||||
len = end - start + 1;
|
||||
temp = (char *)xmalloc (len + 1);
|
||||
strncpy (temp, rl_line_buffer + start, len);
|
||||
temp[len] = '\0';
|
||||
homedir = tilde_expand (temp);
|
||||
xfree (temp);
|
||||
|
||||
_rl_replace_text (homedir, start, end);
|
||||
xfree (homedir);
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
#if defined (USE_VARARGS)
|
||||
void
|
||||
#if defined (PREFER_STDARG)
|
||||
_rl_ttymsg (const char *format, ...)
|
||||
#else
|
||||
_rl_ttymsg (va_alist)
|
||||
va_dcl
|
||||
#endif
|
||||
{
|
||||
va_list args;
|
||||
#if defined (PREFER_VARARGS)
|
||||
char *format;
|
||||
#endif
|
||||
|
||||
#if defined (PREFER_STDARG)
|
||||
va_start (args, format);
|
||||
#else
|
||||
va_start (args);
|
||||
format = va_arg (args, char *);
|
||||
#endif
|
||||
|
||||
fprintf (stderr, "readline: ");
|
||||
vfprintf (stderr, format, args);
|
||||
fprintf (stderr, "\n");
|
||||
fflush (stderr);
|
||||
|
||||
va_end (args);
|
||||
|
||||
rl_forced_update_display ();
|
||||
}
|
||||
|
||||
void
|
||||
#if defined (PREFER_STDARG)
|
||||
_rl_errmsg (const char *format, ...)
|
||||
#else
|
||||
_rl_errmsg (va_alist)
|
||||
va_dcl
|
||||
#endif
|
||||
{
|
||||
va_list args;
|
||||
#if defined (PREFER_VARARGS)
|
||||
char *format;
|
||||
#endif
|
||||
|
||||
#if defined (PREFER_STDARG)
|
||||
va_start (args, format);
|
||||
#else
|
||||
va_start (args);
|
||||
format = va_arg (args, char *);
|
||||
#endif
|
||||
|
||||
fprintf (stderr, "readline: ");
|
||||
vfprintf (stderr, format, args);
|
||||
fprintf (stderr, "\n");
|
||||
fflush (stderr);
|
||||
|
||||
va_end (args);
|
||||
}
|
||||
|
||||
#else /* !USE_VARARGS */
|
||||
void
|
||||
_rl_ttymsg (format, arg1, arg2)
|
||||
char *format;
|
||||
{
|
||||
fprintf (stderr, "readline: ");
|
||||
fprintf (stderr, format, arg1, arg2);
|
||||
fprintf (stderr, "\n");
|
||||
|
||||
rl_forced_update_display ();
|
||||
}
|
||||
|
||||
void
|
||||
_rl_errmsg (format, arg1, arg2)
|
||||
char *format;
|
||||
{
|
||||
fprintf (stderr, "readline: ");
|
||||
fprintf (stderr, format, arg1, arg2);
|
||||
fprintf (stderr, "\n");
|
||||
}
|
||||
#endif /* !USE_VARARGS */
|
||||
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
/* String Utility Functions */
|
||||
/* */
|
||||
/* **************************************************************** */
|
||||
|
||||
/* Determine if s2 occurs in s1. If so, return a pointer to the
|
||||
match in s1. The compare is case insensitive. */
|
||||
char *
|
||||
_rl_strindex (s1, s2)
|
||||
register const char *s1, *s2;
|
||||
{
|
||||
register int i, l, len;
|
||||
|
||||
for (i = 0, l = strlen (s2), len = strlen (s1); (len - i) >= l; i++)
|
||||
if (_rl_strnicmp (s1 + i, s2, l) == 0)
|
||||
return ((char *) (s1 + i));
|
||||
return ((char *)NULL);
|
||||
}
|
||||
|
||||
#ifndef HAVE_STRPBRK
|
||||
/* Find the first occurrence in STRING1 of any character from STRING2.
|
||||
Return a pointer to the character in STRING1. */
|
||||
char *
|
||||
_rl_strpbrk (string1, string2)
|
||||
const char *string1, *string2;
|
||||
{
|
||||
register const char *scan;
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
mbstate_t ps;
|
||||
register int i, v;
|
||||
|
||||
memset (&ps, 0, sizeof (mbstate_t));
|
||||
#endif
|
||||
|
||||
for (; *string1; string1++)
|
||||
{
|
||||
for (scan = string2; *scan; scan++)
|
||||
{
|
||||
if (*string1 == *scan)
|
||||
return ((char *)string1);
|
||||
}
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
|
||||
{
|
||||
v = _rl_get_char_len (string1, &ps);
|
||||
if (v > 1)
|
||||
string1 += v - 1; /* -1 to account for auto-increment in loop */
|
||||
}
|
||||
#endif
|
||||
}
|
||||
return ((char *)NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined (HAVE_STRCASECMP)
|
||||
/* Compare at most COUNT characters from string1 to string2. Case
|
||||
doesn't matter (strncasecmp). */
|
||||
int
|
||||
_rl_strnicmp (string1, string2, count)
|
||||
char *string1, *string2;
|
||||
int count;
|
||||
{
|
||||
register char *s1, *s2;
|
||||
int d;
|
||||
|
||||
if (count <= 0 || (string1 == string2))
|
||||
return 0;
|
||||
|
||||
s1 = string1;
|
||||
s2 = string2;
|
||||
do
|
||||
{
|
||||
d = _rl_to_lower (*s1) - _rl_to_lower (*s2); /* XXX - cast to unsigned char? */
|
||||
if (d != 0)
|
||||
return d;
|
||||
if (*s1++ == '\0')
|
||||
break;
|
||||
s2++;
|
||||
}
|
||||
while (--count != 0);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* strcmp (), but caseless (strcasecmp). */
|
||||
int
|
||||
_rl_stricmp (string1, string2)
|
||||
char *string1, *string2;
|
||||
{
|
||||
register char *s1, *s2;
|
||||
int d;
|
||||
|
||||
s1 = string1;
|
||||
s2 = string2;
|
||||
|
||||
if (s1 == s2)
|
||||
return 0;
|
||||
|
||||
while ((d = _rl_to_lower (*s1) - _rl_to_lower (*s2)) == 0)
|
||||
{
|
||||
if (*s1++ == '\0')
|
||||
return 0;
|
||||
s2++;
|
||||
}
|
||||
|
||||
return (d);
|
||||
}
|
||||
#endif /* !HAVE_STRCASECMP */
|
||||
|
||||
/* Stupid comparison routine for qsort () ing strings. */
|
||||
int
|
||||
_rl_qsort_string_compare (s1, s2)
|
||||
char **s1, **s2;
|
||||
{
|
||||
#if defined (HAVE_STRCOLL)
|
||||
return (strcoll (*s1, *s2));
|
||||
#else
|
||||
int result;
|
||||
|
||||
result = **s1 - **s2;
|
||||
if (result == 0)
|
||||
result = strcmp (*s1, *s2);
|
||||
|
||||
return result;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Function equivalents for the macros defined in chardefs.h. */
|
||||
#define FUNCTION_FOR_MACRO(f) int (f) (c) int c; { return f (c); }
|
||||
|
||||
FUNCTION_FOR_MACRO (_rl_digit_p)
|
||||
FUNCTION_FOR_MACRO (_rl_digit_value)
|
||||
FUNCTION_FOR_MACRO (_rl_lowercase_p)
|
||||
FUNCTION_FOR_MACRO (_rl_pure_alphabetic)
|
||||
FUNCTION_FOR_MACRO (_rl_to_lower)
|
||||
FUNCTION_FOR_MACRO (_rl_to_upper)
|
||||
FUNCTION_FOR_MACRO (_rl_uppercase_p)
|
||||
|
||||
/* A convenience function, to force memory deallocation to be performed
|
||||
by readline. DLLs on Windows apparently require this. */
|
||||
void
|
||||
rl_free (mem)
|
||||
void *mem;
|
||||
{
|
||||
if (mem)
|
||||
free (mem);
|
||||
}
|
||||
|
||||
/* Backwards compatibility, now that savestring has been removed from
|
||||
all `public' readline header files. */
|
||||
#undef _rl_savestring
|
||||
char *
|
||||
_rl_savestring (s)
|
||||
const char *s;
|
||||
{
|
||||
return (strcpy ((char *)xmalloc (1 + (int)strlen (s)), (s)));
|
||||
}
|
||||
|
||||
#if defined (USE_VARARGS)
|
||||
static FILE *_rl_tracefp;
|
||||
|
||||
void
|
||||
#if defined (PREFER_STDARG)
|
||||
_rl_trace (const char *format, ...)
|
||||
#else
|
||||
_rl_trace (va_alist)
|
||||
va_dcl
|
||||
#endif
|
||||
{
|
||||
va_list args;
|
||||
#if defined (PREFER_VARARGS)
|
||||
char *format;
|
||||
#endif
|
||||
|
||||
#if defined (PREFER_STDARG)
|
||||
va_start (args, format);
|
||||
#else
|
||||
va_start (args);
|
||||
format = va_arg (args, char *);
|
||||
#endif
|
||||
|
||||
if (_rl_tracefp == 0)
|
||||
_rl_tropen ();
|
||||
vfprintf (_rl_tracefp, format, args);
|
||||
fprintf (_rl_tracefp, "\n");
|
||||
fflush (_rl_tracefp);
|
||||
|
||||
va_end (args);
|
||||
}
|
||||
|
||||
int
|
||||
_rl_tropen ()
|
||||
{
|
||||
char fnbuf[128];
|
||||
|
||||
if (_rl_tracefp)
|
||||
fclose (_rl_tracefp);
|
||||
sprintf (fnbuf, "/var/tmp/rltrace.%ld", (long)getpid());
|
||||
unlink(fnbuf);
|
||||
_rl_tracefp = fopen (fnbuf, "w+");
|
||||
return _rl_tracefp != 0;
|
||||
}
|
||||
|
||||
int
|
||||
_rl_trclose ()
|
||||
{
|
||||
int r;
|
||||
|
||||
r = fclose (_rl_tracefp);
|
||||
_rl_tracefp = 0;
|
||||
return r;
|
||||
}
|
||||
|
||||
void
|
||||
_rl_settracefp (fp)
|
||||
FILE *fp;
|
||||
{
|
||||
_rl_tracefp = fp;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if HAVE_DECL_AUDIT_USER_TTY && defined (ENABLE_TTY_AUDIT_SUPPORT)
|
||||
#include <sys/socket.h>
|
||||
#include <linux/audit.h>
|
||||
#include <linux/netlink.h>
|
||||
|
||||
/* Report STRING to the audit system. */
|
||||
void
|
||||
_rl_audit_tty (string)
|
||||
char *string;
|
||||
{
|
||||
struct sockaddr_nl addr;
|
||||
struct msghdr msg;
|
||||
struct nlmsghdr nlm;
|
||||
struct iovec iov[2];
|
||||
size_t size;
|
||||
int fd;
|
||||
|
||||
fd = socket (AF_NETLINK, SOCK_RAW, NETLINK_AUDIT);
|
||||
if (fd < 0)
|
||||
return;
|
||||
size = strlen (string) + 1;
|
||||
|
||||
nlm.nlmsg_len = NLMSG_LENGTH (size);
|
||||
nlm.nlmsg_type = AUDIT_USER_TTY;
|
||||
nlm.nlmsg_flags = NLM_F_REQUEST;
|
||||
nlm.nlmsg_seq = 0;
|
||||
nlm.nlmsg_pid = 0;
|
||||
|
||||
iov[0].iov_base = &nlm;
|
||||
iov[0].iov_len = sizeof (nlm);
|
||||
iov[1].iov_base = string;
|
||||
iov[1].iov_len = size;
|
||||
|
||||
addr.nl_family = AF_NETLINK;
|
||||
addr.nl_pid = 0;
|
||||
addr.nl_groups = 0;
|
||||
|
||||
msg.msg_name = &addr;
|
||||
msg.msg_namelen = sizeof (addr);
|
||||
msg.msg_iov = iov;
|
||||
msg.msg_iovlen = 2;
|
||||
msg.msg_control = NULL;
|
||||
msg.msg_controllen = 0;
|
||||
msg.msg_flags = 0;
|
||||
|
||||
(void)sendmsg (fd, &msg, 0);
|
||||
close (fd);
|
||||
}
|
||||
#endif
|
||||
+289
-452
File diff suppressed because it is too large
Load Diff
+8
-3
@@ -9,12 +9,17 @@ TARF=${FROOT}.tar
|
||||
SRC=/usr/homes/chet/src/bash/src
|
||||
|
||||
fflag= sflag= dflag=
|
||||
while getopts "dfs" opt
|
||||
while getopts "dfsp:" opt
|
||||
do
|
||||
case $opt in
|
||||
f) fflag=1 ;;
|
||||
s) sflag=1 ;;
|
||||
d) dflag=1 ;;
|
||||
f) fflag=1 ;;
|
||||
p) PARENT=$OPTARG
|
||||
if [ ! -d "$PARENT" ]; then
|
||||
echo "mk-takehome: $PARENT: directory does not exist" 2>&1
|
||||
exit 2
|
||||
fi ;;
|
||||
s) sflag=1 ;;
|
||||
*) echo "mk-takehome: usage: mk-takehome [-dfs]" 2>&1
|
||||
exit 2;;
|
||||
esac
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
BUILD_DIR=/usr/local/build/chet/bash/bash-current
|
||||
BUILD_DIR=/usr/local/build/bash/bash-current
|
||||
THIS_SH=$BUILD_DIR/bash
|
||||
PATH=$PATH:$BUILD_DIR
|
||||
|
||||
|
||||
Executable
+9
@@ -0,0 +1,9 @@
|
||||
BUILD_DIR=/usr/local/build/chet/bash/bash-current
|
||||
THIS_SH=$BUILD_DIR/bash
|
||||
PATH=$PATH:$BUILD_DIR
|
||||
|
||||
export THIS_SH PATH
|
||||
|
||||
rm -f /tmp/xx
|
||||
|
||||
/bin/sh "$@"
|
||||
Reference in New Issue
Block a user