mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-06-28 07:59:50 +02:00
bash-4.0 remove leftover and stray files
This commit is contained in:
@@ -1,58 +0,0 @@
|
||||
/* memalloc.h -- consolidate code for including alloca.h or malloc.h and
|
||||
defining alloca. */
|
||||
|
||||
/* Copyright (C) 1993 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
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 2, or (at your option) any later
|
||||
version.
|
||||
|
||||
Bash 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 Bash; see the file COPYING. If not, write to the Free Software
|
||||
Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
|
||||
|
||||
#if !defined (_MEMALLOC_H_)
|
||||
# define _MEMALLOC_H_
|
||||
|
||||
#if defined (sparc) && defined (sun) && !defined (HAVE_ALLOCA_H)
|
||||
# define HAVE_ALLOCA_H
|
||||
#endif
|
||||
|
||||
#if defined (__GNUC__) && !defined (HAVE_ALLOCA)
|
||||
# define HAVE_ALLOCA
|
||||
#endif
|
||||
|
||||
#if defined (HAVE_ALLOCA_H) && !defined (HAVE_ALLOCA)
|
||||
# define HAVE_ALLOCA
|
||||
#endif /* HAVE_ALLOCA_H && !HAVE_ALLOCA */
|
||||
|
||||
#if defined (__GNUC__) && !defined (C_ALLOCA)
|
||||
# undef alloca
|
||||
# define alloca __builtin_alloca
|
||||
#else /* !__GNUC__ || C_ALLOCA */
|
||||
# if defined (HAVE_ALLOCA_H) && !defined (C_ALLOCA)
|
||||
# if defined (IBMESA)
|
||||
# include <malloc.h>
|
||||
# else /* !IBMESA */
|
||||
# include <alloca.h>
|
||||
# endif /* !IBMESA */
|
||||
# else /* !HAVE_ALLOCA_H || C_ALLOCA */
|
||||
# if defined (__hpux) && defined (__STDC__) && !defined (alloca)
|
||||
extern void *alloca ();
|
||||
# else
|
||||
# if !defined (alloca)
|
||||
extern char *alloca ();
|
||||
# endif /* !alloca */
|
||||
# endif /* !__hpux || !__STDC__ && !alloca */
|
||||
# endif /* !HAVE_ALLOCA_H || C_ALLOCA */
|
||||
#endif /* !__GNUC__ || C_ALLOCA */
|
||||
|
||||
#endif /* _MEMALLOC_H_ */
|
||||
@@ -1,445 +0,0 @@
|
||||
/* shmbutil.h -- utility functions for multibyte characters. */
|
||||
|
||||
/* Copyright (C) 2002-2004 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
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 2, or (at your option) any later
|
||||
version.
|
||||
|
||||
Bash 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 Bash; see the file COPYING. If not, write to the Free Software
|
||||
Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
|
||||
|
||||
#if !defined (_SH_MBUTIL_H_)
|
||||
#define _SH_MBUTIL_H_
|
||||
|
||||
#include "stdc.h"
|
||||
|
||||
/* Include config.h for HANDLE_MULTIBYTE */
|
||||
#include <config.h>
|
||||
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
|
||||
extern size_t xmbsrtowcs __P((wchar_t *, const char **, size_t, mbstate_t *));
|
||||
extern size_t xdupmbstowcs __P((wchar_t **, char ***, const char *));
|
||||
|
||||
extern size_t mbstrlen __P((const char *));
|
||||
|
||||
extern char *xstrchr __P((const char *, int));
|
||||
|
||||
#ifndef MB_INVALIDCH
|
||||
#define MB_INVALIDCH(x) ((x) == (size_t)-1 || (x) == (size_t)-2)
|
||||
#define MB_NULLWCH(x) ((x) == 0)
|
||||
#endif
|
||||
|
||||
#define MBSLEN(s) (((s) && (s)[0]) ? ((s)[1] ? mbstrlen (s) : 1) : 0)
|
||||
#define MB_STRLEN(s) ((MB_CUR_MAX > 1) ? MBSLEN (s) : STRLEN (s))
|
||||
|
||||
#define MBLEN(s, n) ((MB_CUR_MAX > 1) ? mblen ((s), (n)) : 1)
|
||||
#define MBRLEN(s, n, p) ((MB_CUR_MAX > 1) ? mbrlen ((s), (n), (p)) : 1)
|
||||
|
||||
#else /* !HANDLE_MULTIBYTE */
|
||||
|
||||
#undef MB_LEN_MAX
|
||||
#undef MB_CUR_MAX
|
||||
|
||||
#define MB_LEN_MAX 1
|
||||
#define MB_CUR_MAX 1
|
||||
|
||||
#undef xstrchr
|
||||
#define xstrchr(s, c) strchr(s, c)
|
||||
|
||||
#ifndef MB_INVALIDCH
|
||||
#define MB_INVALIDCH(x) (0)
|
||||
#define MB_NULLWCH(x) (0)
|
||||
#endif
|
||||
|
||||
#define MB_STRLEN(s) (STRLEN(s))
|
||||
|
||||
#define MBLEN(s, n) 1
|
||||
#define MBRLEN(s, n, p) 1
|
||||
|
||||
#endif /* !HANDLE_MULTIBYTE */
|
||||
|
||||
/* Declare and initialize a multibyte state. Call must be terminated
|
||||
with `;'. */
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
# define DECLARE_MBSTATE \
|
||||
mbstate_t state; \
|
||||
memset (&state, '\0', sizeof (mbstate_t))
|
||||
#else
|
||||
# define DECLARE_MBSTATE
|
||||
#endif /* !HANDLE_MULTIBYTE */
|
||||
|
||||
/* Initialize or reinitialize a multibyte state named `state'. Call must be
|
||||
terminated with `;'. */
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
# define INITIALIZE_MBSTATE memset (&state, '\0', sizeof (mbstate_t))
|
||||
#else
|
||||
# define INITIALIZE_MBSTATE
|
||||
#endif /* !HANDLE_MULTIBYTE */
|
||||
|
||||
/* Advance one (possibly multi-byte) character in string _STR of length
|
||||
_STRSIZE, starting at index _I. STATE must have already been declared. */
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
# define ADVANCE_CHAR(_str, _strsize, _i) \
|
||||
do \
|
||||
{ \
|
||||
if (MB_CUR_MAX > 1) \
|
||||
{ \
|
||||
mbstate_t state_bak; \
|
||||
size_t mblength; \
|
||||
\
|
||||
state_bak = state; \
|
||||
mblength = mbrlen ((_str) + (_i), (_strsize) - (_i), &state); \
|
||||
\
|
||||
if (mblength == (size_t)-2 || mblength == (size_t)-1) \
|
||||
{ \
|
||||
state = state_bak; \
|
||||
(_i)++; \
|
||||
} \
|
||||
else if (mblength == 0) \
|
||||
(_i)++; \
|
||||
else \
|
||||
(_i) += mblength; \
|
||||
} \
|
||||
else \
|
||||
(_i)++; \
|
||||
} \
|
||||
while (0)
|
||||
#else
|
||||
# define ADVANCE_CHAR(_str, _strsize, _i) (_i)++
|
||||
#endif /* !HANDLE_MULTIBYTE */
|
||||
|
||||
/* Advance one (possibly multibyte) character in the string _STR of length
|
||||
_STRSIZE.
|
||||
SPECIAL: assume that _STR will be incremented by 1 after this call. */
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
# define ADVANCE_CHAR_P(_str, _strsize) \
|
||||
do \
|
||||
{ \
|
||||
if (MB_CUR_MAX > 1) \
|
||||
{ \
|
||||
mbstate_t state_bak; \
|
||||
size_t mblength; \
|
||||
\
|
||||
state_bak = state; \
|
||||
mblength = mbrlen ((_str), (_strsize), &state); \
|
||||
\
|
||||
if (mblength == (size_t)-2 || mblength == (size_t)-1) \
|
||||
{ \
|
||||
state = state_bak; \
|
||||
mblength = 1; \
|
||||
} \
|
||||
else \
|
||||
(_str) += (mblength < 1) ? 0 : (mblength - 1); \
|
||||
} \
|
||||
} \
|
||||
while (0)
|
||||
#else
|
||||
# define ADVANCE_CHAR_P(_str, _strsize)
|
||||
#endif /* !HANDLE_MULTIBYTE */
|
||||
|
||||
/* Back up one (possibly multi-byte) character in string _STR of length
|
||||
_STRSIZE, starting at index _I. STATE must have already been declared. */
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
# define BACKUP_CHAR(_str, _strsize, _i) \
|
||||
do \
|
||||
{ \
|
||||
if (MB_CUR_MAX > 1) \
|
||||
{ \
|
||||
mbstate_t state_bak; \
|
||||
size_t mblength; \
|
||||
int _x, _p; /* _x == temp index into string, _p == prev index */ \
|
||||
\
|
||||
_x = _p = 0; \
|
||||
while (_x < (_i)) \
|
||||
{ \
|
||||
state_bak = state; \
|
||||
mblength = mbrlen ((_str) + (_x), (_strsize) - (_x), &state); \
|
||||
\
|
||||
if (mblength == (size_t)-2 || mblength == (size_t)-1) \
|
||||
{ \
|
||||
state = state_bak; \
|
||||
_x++; \
|
||||
} \
|
||||
else if (mblength == 0) \
|
||||
_x++; \
|
||||
else \
|
||||
{ \
|
||||
_p = _x; /* _p == start of prev mbchar */ \
|
||||
_x += mblength; \
|
||||
} \
|
||||
} \
|
||||
(_i) = _p; \
|
||||
} \
|
||||
else \
|
||||
(_i)--; \
|
||||
} \
|
||||
while (0)
|
||||
#else
|
||||
# define BACKUP_CHAR(_str, _strsize, _i) (_i)--
|
||||
#endif /* !HANDLE_MULTIBYTE */
|
||||
|
||||
/* Back up one (possibly multibyte) character in the string _BASE of length
|
||||
_STRSIZE starting at _STR (_BASE <= _STR <= (_BASE + _STRSIZE) ).
|
||||
SPECIAL: DO NOT assume that _STR will be decremented by 1 after this call. */
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
# define BACKUP_CHAR_P(_base, _strsize, _str) \
|
||||
do \
|
||||
{ \
|
||||
if (MB_CUR_MAX > 1) \
|
||||
{ \
|
||||
mbstate_t state_bak; \
|
||||
size_t mblength; \
|
||||
char *_x, _p; /* _x == temp pointer into string, _p == prev pointer */ \
|
||||
\
|
||||
_x = _p = _base; \
|
||||
while (_x < (_str)) \
|
||||
{ \
|
||||
state_bak = state; \
|
||||
mblength = mbrlen (_x, (_strsize) - _x, &state); \
|
||||
\
|
||||
if (mblength == (size_t)-2 || mblength == (size_t)-1) \
|
||||
{ \
|
||||
state = state_bak; \
|
||||
_x++; \
|
||||
} \
|
||||
else if (mblength == 0) \
|
||||
_x++; \
|
||||
else \
|
||||
{ \
|
||||
_p = _x; /* _p == start of prev mbchar */ \
|
||||
_x += mblength; \
|
||||
} \
|
||||
} \
|
||||
(_str) = _p; \
|
||||
} \
|
||||
else \
|
||||
(_str)--; \
|
||||
} \
|
||||
while (0)
|
||||
#else
|
||||
# define BACKUP_CHAR_P(_base, _strsize, _str) (_str)--
|
||||
#endif /* !HANDLE_MULTIBYTE */
|
||||
|
||||
/* Copy a single character from the string _SRC to the string _DST.
|
||||
_SRCEND is a pointer to the end of _SRC. */
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
# define COPY_CHAR_P(_dst, _src, _srcend) \
|
||||
do \
|
||||
{ \
|
||||
if (MB_CUR_MAX > 1) \
|
||||
{ \
|
||||
mbstate_t state_bak; \
|
||||
size_t mblength; \
|
||||
int _k; \
|
||||
\
|
||||
state_bak = state; \
|
||||
mblength = mbrlen ((_src), (_srcend) - (_src), &state); \
|
||||
if (mblength == (size_t)-2 || mblength == (size_t)-1) \
|
||||
{ \
|
||||
state = state_bak; \
|
||||
mblength = 1; \
|
||||
} \
|
||||
else \
|
||||
mblength = (mblength < 1) ? 1 : mblength; \
|
||||
\
|
||||
for (_k = 0; _k < mblength; _k++) \
|
||||
*(_dst)++ = *(_src)++; \
|
||||
} \
|
||||
else \
|
||||
*(_dst)++ = *(_src)++; \
|
||||
} \
|
||||
while (0)
|
||||
#else
|
||||
# define COPY_CHAR_P(_dst, _src, _srcend) *(_dst)++ = *(_src)++
|
||||
#endif /* !HANDLE_MULTIBYTE */
|
||||
|
||||
/* Copy a single character from the string _SRC at index _SI to the string
|
||||
_DST at index _DI. _SRCEND is a pointer to the end of _SRC. */
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
# define COPY_CHAR_I(_dst, _di, _src, _srcend, _si) \
|
||||
do \
|
||||
{ \
|
||||
if (MB_CUR_MAX > 1) \
|
||||
{ \
|
||||
mbstate_t state_bak; \
|
||||
size_t mblength; \
|
||||
int _k; \
|
||||
\
|
||||
state_bak = state; \
|
||||
mblength = mbrlen ((_src) + (_si), (_srcend) - ((_src)+(_si)), &state); \
|
||||
if (mblength == (size_t)-2 || mblength == (size_t)-1) \
|
||||
{ \
|
||||
state = state_bak; \
|
||||
mblength = 1; \
|
||||
} \
|
||||
else \
|
||||
mblength = (mblength < 1) ? 1 : mblength; \
|
||||
\
|
||||
for (_k = 0; _k < mblength; _k++) \
|
||||
_dst[_di++] = _src[_si++]; \
|
||||
} \
|
||||
else \
|
||||
_dst[_di++] = _src[_si++]; \
|
||||
} \
|
||||
while (0)
|
||||
#else
|
||||
# define COPY_CHAR_I(_dst, _di, _src, _srcend, _si) _dst[_di++] = _src[_si++]
|
||||
#endif /* !HANDLE_MULTIBYTE */
|
||||
|
||||
/****************************************************************
|
||||
* *
|
||||
* The following are only guaranteed to work in subst.c *
|
||||
* *
|
||||
****************************************************************/
|
||||
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
# define SCOPY_CHAR_I(_dst, _escchar, _sc, _src, _si, _slen) \
|
||||
do \
|
||||
{ \
|
||||
if (MB_CUR_MAX > 1) \
|
||||
{ \
|
||||
mbstate_t state_bak; \
|
||||
size_t mblength; \
|
||||
int _i; \
|
||||
\
|
||||
state_bak = state; \
|
||||
mblength = mbrlen ((_src) + (_si), (_slen) - (_si), &state); \
|
||||
if (mblength == (size_t)-2 || mblength == (size_t)-1) \
|
||||
{ \
|
||||
state = state_bak; \
|
||||
mblength = 1; \
|
||||
} \
|
||||
else \
|
||||
mblength = (mblength < 1) ? 1 : mblength; \
|
||||
\
|
||||
temp = xmalloc (mblength + 2); \
|
||||
temp[0] = _escchar; \
|
||||
for (_i = 0; _i < mblength; _i++) \
|
||||
temp[_i + 1] = _src[_si++]; \
|
||||
temp[mblength + 1] = '\0'; \
|
||||
\
|
||||
goto add_string; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
_dst[0] = _escchar; \
|
||||
_dst[1] = _sc; \
|
||||
} \
|
||||
} \
|
||||
while (0)
|
||||
#else
|
||||
# define SCOPY_CHAR_I(_dst, _escchar, _sc, _src, _si, _slen) \
|
||||
_dst[0] = _escchar; \
|
||||
_dst[1] = _sc
|
||||
#endif /* !HANDLE_MULTIBYTE */
|
||||
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
# define SCOPY_CHAR_M(_dst, _src, _srcend, _si) \
|
||||
do \
|
||||
{ \
|
||||
if (MB_CUR_MAX > 1) \
|
||||
{ \
|
||||
mbstate_t state_bak; \
|
||||
size_t mblength; \
|
||||
\
|
||||
state_bak = state; \
|
||||
mblength = mbrlen ((_src) + (_si), (_srcend) - ((_src) + (_si)), &state); \
|
||||
if (mblength == (size_t)-2 || mblength == (size_t)-1) \
|
||||
{ \
|
||||
state = state_bak; \
|
||||
mblength = 1; \
|
||||
} \
|
||||
else \
|
||||
mblength = (mblength < 1) ? 1 : mblength; \
|
||||
\
|
||||
FASTCOPY(((_src) + (_si)), (_dst), mblength); \
|
||||
\
|
||||
(_dst) += mblength; \
|
||||
(_si) += mblength; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
*(_dst)++ = _src[(_si)]; \
|
||||
(_si)++; \
|
||||
} \
|
||||
} \
|
||||
while (0)
|
||||
#else
|
||||
# define SCOPY_CHAR_M(_dst, _src, _srcend, _si) \
|
||||
*(_dst)++ = _src[(_si)]; \
|
||||
(_si)++
|
||||
#endif /* !HANDLE_MULTIBYTE */
|
||||
|
||||
#if HANDLE_MULTIBYTE
|
||||
# define SADD_MBCHAR(_dst, _src, _si, _srcsize) \
|
||||
do \
|
||||
{ \
|
||||
if (MB_CUR_MAX > 1) \
|
||||
{ \
|
||||
int i; \
|
||||
mbstate_t state_bak; \
|
||||
size_t mblength; \
|
||||
\
|
||||
state_bak = state; \
|
||||
mblength = mbrlen ((_src) + (_si), (_srcsize) - (_si), &state); \
|
||||
if (mblength == (size_t)-1 || mblength == (size_t)-2) \
|
||||
{ \
|
||||
state = state_bak; \
|
||||
mblength = 1; \
|
||||
} \
|
||||
if (mblength < 1) \
|
||||
mblength = 1; \
|
||||
\
|
||||
_dst = (char *)xmalloc (mblength + 1); \
|
||||
for (i = 0; i < mblength; i++) \
|
||||
(_dst)[i] = (_src)[(_si)++]; \
|
||||
(_dst)[mblength] = '\0'; \
|
||||
\
|
||||
goto add_string; \
|
||||
} \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
#else
|
||||
# define SADD_MBCHAR(_dst, _src, _si, _srcsize)
|
||||
#endif
|
||||
|
||||
/* Watch out when using this -- it's just straight textual subsitution */
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
# define SADD_MBQCHAR_BODY(_dst, _src, _si, _srcsize) \
|
||||
\
|
||||
int i; \
|
||||
mbstate_t state_bak; \
|
||||
size_t mblength; \
|
||||
\
|
||||
state_bak = state; \
|
||||
mblength = mbrlen ((_src) + (_si), (_srcsize) - (_si), &state); \
|
||||
if (mblength == (size_t)-1 || mblength == (size_t)-2) \
|
||||
{ \
|
||||
state = state_bak; \
|
||||
mblength = 1; \
|
||||
} \
|
||||
if (mblength < 1) \
|
||||
mblength = 1; \
|
||||
\
|
||||
(_dst) = (char *)xmalloc (mblength + 2); \
|
||||
(_dst)[0] = CTLESC; \
|
||||
for (i = 0; i < mblength; i++) \
|
||||
(_dst)[i+1] = (_src)[(_si)++]; \
|
||||
(_dst)[mblength+1] = '\0'; \
|
||||
\
|
||||
goto add_string
|
||||
|
||||
#endif /* HANDLE_MULTIBYTE */
|
||||
#endif /* _SH_MBUTIL_H_ */
|
||||
@@ -1,112 +0,0 @@
|
||||
/* Copyright (C) 1999 Free Software Foundation, Inc. */
|
||||
|
||||
/* This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
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 2, or (at your option) any later
|
||||
version.
|
||||
|
||||
Bash 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 Bash; see the file COPYING. If not, write to the Free Software
|
||||
Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
|
||||
|
||||
/*
|
||||
* shtty.h -- include the correct system-dependent files to manipulate the
|
||||
* tty
|
||||
*/
|
||||
|
||||
#ifndef __SH_TTY_H_
|
||||
#define __SH_TTY_H_
|
||||
|
||||
#include "stdc.h"
|
||||
|
||||
#if defined (_POSIX_VERSION) && defined (HAVE_TERMIOS_H) && defined (HAVE_TCGETATTR) && !defined (TERMIOS_MISSING)
|
||||
# define TERMIOS_TTY_DRIVER
|
||||
#else
|
||||
# if defined (HAVE_TERMIO_H)
|
||||
# define TERMIO_TTY_DRIVER
|
||||
# else
|
||||
# define NEW_TTY_DRIVER
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The _POSIX_SOURCE define is to avoid multiple symbol definitions
|
||||
* between sys/ioctl.h and termios.h. Ditto for the test against SunOS4
|
||||
* and the undefining of several symbols.
|
||||
*/
|
||||
|
||||
#ifdef TERMIOS_TTY_DRIVER
|
||||
# if (defined (SunOS4) || defined (SunOS5)) && !defined (_POSIX_SOURCE)
|
||||
# define _POSIX_SOURCE
|
||||
# endif
|
||||
# if defined (SunOS4)
|
||||
# undef ECHO
|
||||
# undef NOFLSH
|
||||
# undef TOSTOP
|
||||
# endif /* SunOS4 */
|
||||
# include <termios.h>
|
||||
# define TTYSTRUCT struct termios
|
||||
#else
|
||||
# ifdef TERMIO_TTY_DRIVER
|
||||
# include <termio.h>
|
||||
# define TTYSTRUCT struct termio
|
||||
# else /* NEW_TTY_DRIVER */
|
||||
# include <sgtty.h>
|
||||
# define TTYSTRUCT struct sgttyb
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Functions imported from lib/sh/shtty.c */
|
||||
|
||||
/* Get and set terminal attributes for the file descriptor passed as
|
||||
an argument. */
|
||||
extern int ttgetattr __P((int, TTYSTRUCT *));
|
||||
extern int ttsetattr __P((int, TTYSTRUCT *));
|
||||
|
||||
/* Save and restore the terminal's attributes from static storage. */
|
||||
extern void ttsave __P((void));
|
||||
extern void ttrestore __P((void));
|
||||
|
||||
/* Return the attributes corresponding to the file descriptor (0 or 1)
|
||||
passed as an argument. */
|
||||
extern TTYSTRUCT *ttattr __P((int));
|
||||
|
||||
/* These functions only operate on the passed TTYSTRUCT; they don't
|
||||
actually change anything with the kernel's current tty settings. */
|
||||
extern int tt_setonechar __P((TTYSTRUCT *));
|
||||
extern int tt_setnoecho __P((TTYSTRUCT *));
|
||||
extern int tt_seteightbit __P((TTYSTRUCT *));
|
||||
extern int tt_setnocanon __P((TTYSTRUCT *));
|
||||
extern int tt_setcbreak __P((TTYSTRUCT *));
|
||||
|
||||
/* These functions are all generally mutually exclusive. If you call
|
||||
more than one (bracketed with calls to ttsave and ttrestore, of
|
||||
course), the right thing will happen, but more system calls will be
|
||||
executed than absolutely necessary. You can do all of this yourself
|
||||
with the other functions; these are only conveniences. */
|
||||
|
||||
/* These functions work with a given file descriptor and set terminal
|
||||
attributes */
|
||||
extern int ttfd_onechar __P((int, TTYSTRUCT *));
|
||||
extern int ttfd_noecho __P((int, TTYSTRUCT *));
|
||||
extern int ttfd_eightbit __P((int, TTYSTRUCT *));
|
||||
extern int ttfd_nocanon __P((int, TTYSTRUCT *));
|
||||
|
||||
extern int ttcbreak __P((int, TTYSTRUCT *));
|
||||
|
||||
/* These functions work with fd 0 and the TTYSTRUCT saved with ttsave () */
|
||||
extern int ttonechar __P((void));
|
||||
extern int ttnoecho __P((void));
|
||||
extern int tteightbit __P((void));
|
||||
extern int ttnocanon __P((void));
|
||||
|
||||
extern int ttcbreak __P((void));
|
||||
|
||||
#endif
|
||||
@@ -1,80 +0,0 @@
|
||||
/* typemax.h -- encapsulate max values for long, long long, etc. */
|
||||
|
||||
/* Copyright (C) 2001 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
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 2, or (at your option) any later
|
||||
version.
|
||||
|
||||
Bash 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 Bash; see the file COPYING. If not, write to the Free Software
|
||||
Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
|
||||
|
||||
/*
|
||||
* NOTE: This should be included after config.h, limits.h, stdint.h, and
|
||||
* inttypes.h
|
||||
*/
|
||||
|
||||
#ifndef _SH_TYPEMAX_H
|
||||
#define _SH_TYPEMAX_H
|
||||
|
||||
#ifndef CHAR_BIT
|
||||
# define CHAR_BIT 8
|
||||
#endif
|
||||
|
||||
/* Nonzero if the integer type T is signed. */
|
||||
#ifndef TYPE_SIGNED
|
||||
# define TYPE_SIGNED(t) (! ((t) 0 < (t) -1))
|
||||
#endif
|
||||
|
||||
#ifndef TYPE_MINIMUM
|
||||
# define TYPE_MINIMUM(t) ((t) (TYPE_SIGNED (t) \
|
||||
? ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1) \
|
||||
: (t) 0))
|
||||
#endif
|
||||
|
||||
#ifndef TYPE_MAXIMUM
|
||||
# define TYPE_MAXIMUM(t) ((t) (~ (t) 0 - TYPE_MINIMUM (t)))
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_LONG_LONG
|
||||
# ifndef LLONG_MAX
|
||||
# define LLONG_MAX TYPE_MAXIMUM(long long int)
|
||||
# define LLONG_MIN TYPE_MINIMUM(long long int)
|
||||
# endif
|
||||
# ifndef ULLONG_MAX
|
||||
# define ULLONG_MAX TYPE_MAXIMUM(unsigned long long int)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef ULONG_MAX
|
||||
# define ULONG_MAX ((unsigned long) ~(unsigned long) 0)
|
||||
#endif
|
||||
|
||||
#ifndef LONG_MAX
|
||||
# define LONG_MAX ((long int) (ULONG_MAX >> 1))
|
||||
# define LONG_MIN ((long int) (-LONG_MAX - 1L))
|
||||
#endif
|
||||
|
||||
#ifndef INT_MAX /* ouch */
|
||||
# define INT_MAX TYPE_MAXIMUM(int)
|
||||
# define INT_MIN TYPE_MINIMUM(int)
|
||||
# define UINT_MAX ((unsigned int) ~(unsigned int)0)
|
||||
#endif
|
||||
|
||||
/* workaround for gcc bug in versions < 2.7 */
|
||||
#if defined (HAVE_LONG_LONG) && __GNUC__ == 2 && __GNUC_MINOR__ < 7
|
||||
static const unsigned long long int maxquad = ULLONG_MAX;
|
||||
# undef ULLONG_MAX
|
||||
# define ULLONG_MAX maxquad
|
||||
#endif
|
||||
|
||||
#endif /* _SH_TYPEMAX_H */
|
||||
Reference in New Issue
Block a user