mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-08-11 12:40:42 +02:00
Bash-5.3-rc1 release
This commit is contained in:
@@ -1,50 +0,0 @@
|
||||
/* <dir.h> -- definitions for 4.2BSD-compatible directory access.
|
||||
last edit: 09-Jul-1983 D A Gwyn. */
|
||||
|
||||
#if defined (VMS)
|
||||
# if !defined (FAB$C_BID)
|
||||
# include <fab.h>
|
||||
# endif
|
||||
# if !defined (NAM$C_BID)
|
||||
# include <nam.h>
|
||||
# endif
|
||||
# if !defined (RMS$_SUC)
|
||||
# include <rmsdef.h>
|
||||
# endif
|
||||
# include "dir.h"
|
||||
#endif /* VMS */
|
||||
|
||||
/* Size of directory block. */
|
||||
#define DIRBLKSIZ 512
|
||||
|
||||
/* NOTE: MAXNAMLEN must be one less than a multiple of 4 */
|
||||
|
||||
#if defined (VMS)
|
||||
# define MAXNAMLEN (DIR$S_NAME + 7) /* 80 plus room for version #. */
|
||||
# define MAXFULLSPEC NAM$C_MAXRSS /* Maximum full spec */
|
||||
#else
|
||||
# define MAXNAMLEN 15 /* Maximum filename length. */
|
||||
#endif /* VMS */
|
||||
|
||||
/* Data from readdir (). */
|
||||
struct direct {
|
||||
long d_ino; /* Inode number of entry. */
|
||||
unsigned short d_reclen; /* Length of this record. */
|
||||
unsigned short d_namlen; /* Length of string in d_name. */
|
||||
char d_name[MAXNAMLEN + 1]; /* Name of file. */
|
||||
};
|
||||
|
||||
/* Stream data from opendir (). */
|
||||
typedef struct {
|
||||
int dd_fd; /* File descriptor. */
|
||||
int dd_loc; /* Offset in block. */
|
||||
int dd_size; /* Amount of valid data. */
|
||||
char dd_buf[DIRBLKSIZ]; /* Directory block. */
|
||||
} DIR;
|
||||
|
||||
extern DIR *opendir ();
|
||||
extern struct direct *readdir ();
|
||||
extern long telldir ();
|
||||
extern void seekdir (), closedir ();
|
||||
|
||||
#define rewinddir(dirp) seekdir (dirp, 0L)
|
||||
@@ -1,4 +0,0 @@
|
||||
2003-05-22 GNU <bug-gnu-gettext@gnu.org>
|
||||
|
||||
* Version 0.12.1 released.
|
||||
|
||||
@@ -1,465 +0,0 @@
|
||||
#! /bin/sh
|
||||
# Output a system dependent table of character encoding aliases.
|
||||
#
|
||||
# Copyright (C) 2000-2009 Free Software Foundation, Inc.
|
||||
#
|
||||
# This program 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.
|
||||
#
|
||||
# This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# The table consists of lines of the form
|
||||
# ALIAS CANONICAL
|
||||
#
|
||||
# ALIAS is the (system dependent) result of "nl_langinfo (CODESET)".
|
||||
# ALIAS is compared in a case sensitive way.
|
||||
#
|
||||
# CANONICAL is the GNU canonical name for this character encoding.
|
||||
# It must be an encoding supported by libiconv. Support by GNU libc is
|
||||
# also desirable. CANONICAL is case insensitive. Usually an upper case
|
||||
# MIME charset name is preferred.
|
||||
# The current list of GNU canonical charset names is as follows.
|
||||
#
|
||||
# name used by which systems a MIME name?
|
||||
# ASCII, ANSI_X3.4-1968 glibc solaris freebsd
|
||||
# ISO-8859-1 glibc aix hpux irix osf solaris freebsd yes
|
||||
# ISO-8859-2 glibc aix hpux irix osf solaris freebsd yes
|
||||
# ISO-8859-3 glibc solaris yes
|
||||
# ISO-8859-4 osf solaris freebsd yes
|
||||
# ISO-8859-5 glibc aix hpux irix osf solaris freebsd yes
|
||||
# ISO-8859-6 glibc aix hpux solaris yes
|
||||
# ISO-8859-7 glibc aix hpux irix osf solaris yes
|
||||
# ISO-8859-8 glibc aix hpux osf solaris yes
|
||||
# ISO-8859-9 glibc aix hpux irix osf solaris yes
|
||||
# ISO-8859-13 glibc
|
||||
# ISO-8859-14 glibc
|
||||
# ISO-8859-15 glibc aix osf solaris freebsd
|
||||
# KOI8-R glibc solaris freebsd yes
|
||||
# KOI8-U glibc freebsd yes
|
||||
# KOI8-T glibc
|
||||
# CP437 dos
|
||||
# CP775 dos
|
||||
# CP850 aix osf dos
|
||||
# CP852 dos
|
||||
# CP855 dos
|
||||
# CP856 aix
|
||||
# CP857 dos
|
||||
# CP861 dos
|
||||
# CP862 dos
|
||||
# CP864 dos
|
||||
# CP865 dos
|
||||
# CP866 freebsd dos
|
||||
# CP869 dos
|
||||
# CP874 woe32 dos
|
||||
# CP922 aix
|
||||
# CP932 aix woe32 dos
|
||||
# CP943 aix
|
||||
# CP949 osf woe32 dos
|
||||
# CP950 woe32 dos
|
||||
# CP1046 aix
|
||||
# CP1124 aix
|
||||
# CP1125 dos
|
||||
# CP1129 aix
|
||||
# CP1250 woe32
|
||||
# CP1251 glibc solaris woe32
|
||||
# CP1252 aix woe32
|
||||
# CP1253 woe32
|
||||
# CP1254 woe32
|
||||
# CP1255 glibc woe32
|
||||
# CP1256 woe32
|
||||
# CP1257 woe32
|
||||
# GB2312 glibc aix hpux irix solaris freebsd yes
|
||||
# EUC-JP glibc aix hpux irix osf solaris freebsd yes
|
||||
# EUC-KR glibc aix hpux irix osf solaris freebsd yes
|
||||
# EUC-TW glibc aix hpux irix osf solaris
|
||||
# BIG5 glibc aix hpux osf solaris freebsd yes
|
||||
# BIG5-HKSCS glibc solaris
|
||||
# GBK glibc aix osf solaris woe32 dos
|
||||
# GB18030 glibc solaris
|
||||
# SHIFT_JIS hpux osf solaris freebsd yes
|
||||
# JOHAB glibc solaris woe32
|
||||
# TIS-620 glibc aix hpux osf solaris
|
||||
# VISCII glibc yes
|
||||
# TCVN5712-1 glibc
|
||||
# GEORGIAN-PS glibc
|
||||
# HP-ROMAN8 hpux
|
||||
# HP-ARABIC8 hpux
|
||||
# HP-GREEK8 hpux
|
||||
# HP-HEBREW8 hpux
|
||||
# HP-TURKISH8 hpux
|
||||
# HP-KANA8 hpux
|
||||
# DEC-KANJI osf
|
||||
# DEC-HANYU osf
|
||||
# UTF-8 glibc aix hpux osf solaris yes
|
||||
#
|
||||
# Note: Names which are not marked as being a MIME name should not be used in
|
||||
# Internet protocols for information interchange (mail, news, etc.).
|
||||
#
|
||||
# Note: ASCII and ANSI_X3.4-1968 are synonymous canonical names. Applications
|
||||
# must understand both names and treat them as equivalent.
|
||||
#
|
||||
# The first argument passed to this file is the canonical host specification,
|
||||
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
|
||||
# or
|
||||
# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
|
||||
|
||||
host="$1"
|
||||
os=`echo "$host" | sed -e 's/^[^-]*-[^-]*-\(.*\)$/\1/'`
|
||||
echo "# This file contains a table of character encoding aliases,"
|
||||
echo "# suitable for operating system '${os}'."
|
||||
echo "# It was automatically generated from config.charset."
|
||||
# List of references, updated during installation:
|
||||
echo "# Packages using this file: "
|
||||
case "$os" in
|
||||
linux* | *-gnu*)
|
||||
# With glibc-2.1 or newer, we don't need any canonicalization,
|
||||
# because glibc has iconv and both glibc and libiconv support all
|
||||
# GNU canonical names directly. Therefore, the Makefile does not
|
||||
# need to install the alias file at all.
|
||||
# The following applies only to glibc-2.0.x and older libcs.
|
||||
echo "ISO_646.IRV:1983 ASCII"
|
||||
;;
|
||||
aix*)
|
||||
echo "ISO8859-1 ISO-8859-1"
|
||||
echo "ISO8859-2 ISO-8859-2"
|
||||
echo "ISO8859-5 ISO-8859-5"
|
||||
echo "ISO8859-6 ISO-8859-6"
|
||||
echo "ISO8859-7 ISO-8859-7"
|
||||
echo "ISO8859-8 ISO-8859-8"
|
||||
echo "ISO8859-9 ISO-8859-9"
|
||||
echo "ISO8859-15 ISO-8859-15"
|
||||
echo "IBM-850 CP850"
|
||||
echo "IBM-856 CP856"
|
||||
echo "IBM-921 ISO-8859-13"
|
||||
echo "IBM-922 CP922"
|
||||
echo "IBM-932 CP932"
|
||||
echo "IBM-943 CP943"
|
||||
echo "IBM-1046 CP1046"
|
||||
echo "IBM-1124 CP1124"
|
||||
echo "IBM-1129 CP1129"
|
||||
echo "IBM-1252 CP1252"
|
||||
echo "IBM-eucCN GB2312"
|
||||
echo "IBM-eucJP EUC-JP"
|
||||
echo "IBM-eucKR EUC-KR"
|
||||
echo "IBM-eucTW EUC-TW"
|
||||
echo "big5 BIG5"
|
||||
echo "GBK GBK"
|
||||
echo "TIS-620 TIS-620"
|
||||
echo "UTF-8 UTF-8"
|
||||
;;
|
||||
hpux*)
|
||||
echo "iso88591 ISO-8859-1"
|
||||
echo "iso88592 ISO-8859-2"
|
||||
echo "iso88595 ISO-8859-5"
|
||||
echo "iso88596 ISO-8859-6"
|
||||
echo "iso88597 ISO-8859-7"
|
||||
echo "iso88598 ISO-8859-8"
|
||||
echo "iso88599 ISO-8859-9"
|
||||
echo "iso885915 ISO-8859-15"
|
||||
echo "roman8 HP-ROMAN8"
|
||||
echo "arabic8 HP-ARABIC8"
|
||||
echo "greek8 HP-GREEK8"
|
||||
echo "hebrew8 HP-HEBREW8"
|
||||
echo "turkish8 HP-TURKISH8"
|
||||
echo "kana8 HP-KANA8"
|
||||
echo "tis620 TIS-620"
|
||||
echo "big5 BIG5"
|
||||
echo "eucJP EUC-JP"
|
||||
echo "eucKR EUC-KR"
|
||||
echo "eucTW EUC-TW"
|
||||
echo "hp15CN GB2312"
|
||||
#echo "ccdc ?" # what is this?
|
||||
echo "SJIS SHIFT_JIS"
|
||||
echo "utf8 UTF-8"
|
||||
;;
|
||||
irix*)
|
||||
echo "ISO8859-1 ISO-8859-1"
|
||||
echo "ISO8859-2 ISO-8859-2"
|
||||
echo "ISO8859-5 ISO-8859-5"
|
||||
echo "ISO8859-7 ISO-8859-7"
|
||||
echo "ISO8859-9 ISO-8859-9"
|
||||
echo "eucCN GB2312"
|
||||
echo "eucJP EUC-JP"
|
||||
echo "eucKR EUC-KR"
|
||||
echo "eucTW EUC-TW"
|
||||
;;
|
||||
osf*)
|
||||
echo "ISO8859-1 ISO-8859-1"
|
||||
echo "ISO8859-2 ISO-8859-2"
|
||||
echo "ISO8859-4 ISO-8859-4"
|
||||
echo "ISO8859-5 ISO-8859-5"
|
||||
echo "ISO8859-7 ISO-8859-7"
|
||||
echo "ISO8859-8 ISO-8859-8"
|
||||
echo "ISO8859-9 ISO-8859-9"
|
||||
echo "ISO8859-15 ISO-8859-15"
|
||||
echo "cp850 CP850"
|
||||
echo "big5 BIG5"
|
||||
echo "dechanyu DEC-HANYU"
|
||||
echo "dechanzi GB2312"
|
||||
echo "deckanji DEC-KANJI"
|
||||
echo "deckorean EUC-KR"
|
||||
echo "eucJP EUC-JP"
|
||||
echo "eucKR EUC-KR"
|
||||
echo "eucTW EUC-TW"
|
||||
echo "GBK GBK"
|
||||
echo "KSC5601 CP949"
|
||||
echo "sdeckanji EUC-JP"
|
||||
echo "SJIS SHIFT_JIS"
|
||||
echo "TACTIS TIS-620"
|
||||
echo "UTF-8 UTF-8"
|
||||
;;
|
||||
solaris*)
|
||||
echo "646 ASCII"
|
||||
echo "ISO8859-1 ISO-8859-1"
|
||||
echo "ISO8859-2 ISO-8859-2"
|
||||
echo "ISO8859-3 ISO-8859-3"
|
||||
echo "ISO8859-4 ISO-8859-4"
|
||||
echo "ISO8859-5 ISO-8859-5"
|
||||
echo "ISO8859-6 ISO-8859-6"
|
||||
echo "ISO8859-7 ISO-8859-7"
|
||||
echo "ISO8859-8 ISO-8859-8"
|
||||
echo "ISO8859-9 ISO-8859-9"
|
||||
echo "ISO8859-15 ISO-8859-15"
|
||||
echo "koi8-r KOI8-R"
|
||||
echo "ansi-1251 CP1251"
|
||||
echo "BIG5 BIG5"
|
||||
echo "Big5-HKSCS BIG5-HKSCS"
|
||||
echo "gb2312 GB2312"
|
||||
echo "GBK GBK"
|
||||
echo "GB18030 GB18030"
|
||||
echo "cns11643 EUC-TW"
|
||||
echo "5601 EUC-KR"
|
||||
echo "ko_KR.johap92 JOHAB"
|
||||
echo "eucJP EUC-JP"
|
||||
echo "PCK SHIFT_JIS"
|
||||
echo "TIS620.2533 TIS-620"
|
||||
#echo "sun_eu_greek ?" # what is this?
|
||||
echo "UTF-8 UTF-8"
|
||||
;;
|
||||
freebsd* | os2*)
|
||||
# FreeBSD 4.2 doesn't have nl_langinfo(CODESET); therefore
|
||||
# localcharset.c falls back to using the full locale name
|
||||
# from the environment variables.
|
||||
# Likewise for OS/2. OS/2 has XFree86 just like FreeBSD. Just
|
||||
# reuse FreeBSD's locale data for OS/2.
|
||||
echo "C ASCII"
|
||||
echo "US-ASCII ASCII"
|
||||
for l in la_LN lt_LN; do
|
||||
echo "$l.ASCII ASCII"
|
||||
done
|
||||
for l in da_DK de_AT de_CH de_DE en_AU en_CA en_GB en_US es_ES \
|
||||
fi_FI fr_BE fr_CA fr_CH fr_FR is_IS it_CH it_IT la_LN \
|
||||
lt_LN nl_BE nl_NL no_NO pt_PT sv_SE; do
|
||||
echo "$l.ISO_8859-1 ISO-8859-1"
|
||||
echo "$l.DIS_8859-15 ISO-8859-15"
|
||||
done
|
||||
for l in cs_CZ hr_HR hu_HU la_LN lt_LN pl_PL sl_SI; do
|
||||
echo "$l.ISO_8859-2 ISO-8859-2"
|
||||
done
|
||||
for l in la_LN lt_LT; do
|
||||
echo "$l.ISO_8859-4 ISO-8859-4"
|
||||
done
|
||||
for l in ru_RU ru_SU; do
|
||||
echo "$l.KOI8-R KOI8-R"
|
||||
echo "$l.ISO_8859-5 ISO-8859-5"
|
||||
echo "$l.CP866 CP866"
|
||||
done
|
||||
echo "uk_UA.KOI8-U KOI8-U"
|
||||
echo "zh_TW.BIG5 BIG5"
|
||||
echo "zh_TW.Big5 BIG5"
|
||||
echo "zh_CN.EUC GB2312"
|
||||
echo "ja_JP.EUC EUC-JP"
|
||||
echo "ja_JP.SJIS SHIFT_JIS"
|
||||
echo "ja_JP.Shift_JIS SHIFT_JIS"
|
||||
echo "ko_KR.EUC EUC-KR"
|
||||
;;
|
||||
netbsd*)
|
||||
echo "646 ASCII"
|
||||
echo "ISO8859-1 ISO-8859-1"
|
||||
echo "ISO8859-2 ISO-8859-2"
|
||||
echo "ISO8859-4 ISO-8859-4"
|
||||
echo "ISO8859-5 ISO-8859-5"
|
||||
echo "ISO8859-15 ISO-8859-15"
|
||||
echo "eucCN GB2312"
|
||||
echo "eucJP EUC-JP"
|
||||
echo "eucKR EUC-KR"
|
||||
echo "eucTW EUC-TW"
|
||||
echo "BIG5 BIG5"
|
||||
echo "SJIS SHIFT_JIS"
|
||||
;;
|
||||
beos*)
|
||||
# BeOS has a single locale, and it has UTF-8 encoding.
|
||||
echo "* UTF-8"
|
||||
;;
|
||||
msdosdjgpp*)
|
||||
# DJGPP 2.03 doesn't have nl_langinfo(CODESET); therefore
|
||||
# localcharset.c falls back to using the full locale name
|
||||
# from the environment variables.
|
||||
echo "#"
|
||||
echo "# The encodings given here may not all be correct."
|
||||
echo "# If you find that the encoding given for your language and"
|
||||
echo "# country is not the one your DOS machine actually uses, just"
|
||||
echo "# correct it in this file, and send a mail to"
|
||||
echo "# Juan Manuel Guerrero <st001906@hrz1.hrz.tu-darmstadt.de>"
|
||||
echo "# and Bruno Haible <bruno@clisp.org>."
|
||||
echo "#"
|
||||
echo "C ASCII"
|
||||
# ISO-8859-1 languages
|
||||
echo "ca CP850"
|
||||
echo "ca_ES CP850"
|
||||
echo "da CP865" # not CP850 ??
|
||||
echo "da_DK CP865" # not CP850 ??
|
||||
echo "de CP850"
|
||||
echo "de_AT CP850"
|
||||
echo "de_CH CP850"
|
||||
echo "de_DE CP850"
|
||||
echo "en CP850"
|
||||
echo "en_AU CP850" # not CP437 ??
|
||||
echo "en_CA CP850"
|
||||
echo "en_GB CP850"
|
||||
echo "en_NZ CP437"
|
||||
echo "en_US CP437"
|
||||
echo "en_ZA CP850" # not CP437 ??
|
||||
echo "es CP850"
|
||||
echo "es_AR CP850"
|
||||
echo "es_BO CP850"
|
||||
echo "es_CL CP850"
|
||||
echo "es_CO CP850"
|
||||
echo "es_CR CP850"
|
||||
echo "es_CU CP850"
|
||||
echo "es_DO CP850"
|
||||
echo "es_EC CP850"
|
||||
echo "es_ES CP850"
|
||||
echo "es_GT CP850"
|
||||
echo "es_HN CP850"
|
||||
echo "es_MX CP850"
|
||||
echo "es_NI CP850"
|
||||
echo "es_PA CP850"
|
||||
echo "es_PY CP850"
|
||||
echo "es_PE CP850"
|
||||
echo "es_SV CP850"
|
||||
echo "es_UY CP850"
|
||||
echo "es_VE CP850"
|
||||
echo "et CP850"
|
||||
echo "et_EE CP850"
|
||||
echo "eu CP850"
|
||||
echo "eu_ES CP850"
|
||||
echo "fi CP850"
|
||||
echo "fi_FI CP850"
|
||||
echo "fr CP850"
|
||||
echo "fr_BE CP850"
|
||||
echo "fr_CA CP850"
|
||||
echo "fr_CH CP850"
|
||||
echo "fr_FR CP850"
|
||||
echo "ga CP850"
|
||||
echo "ga_IE CP850"
|
||||
echo "gd CP850"
|
||||
echo "gd_GB CP850"
|
||||
echo "gl CP850"
|
||||
echo "gl_ES CP850"
|
||||
echo "id CP850" # not CP437 ??
|
||||
echo "id_ID CP850" # not CP437 ??
|
||||
echo "is CP861" # not CP850 ??
|
||||
echo "is_IS CP861" # not CP850 ??
|
||||
echo "it CP850"
|
||||
echo "it_CH CP850"
|
||||
echo "it_IT CP850"
|
||||
echo "lt CP775"
|
||||
echo "lt_LT CP775"
|
||||
echo "lv CP775"
|
||||
echo "lv_LV CP775"
|
||||
echo "nb CP865" # not CP850 ??
|
||||
echo "nb_NO CP865" # not CP850 ??
|
||||
echo "nl CP850"
|
||||
echo "nl_BE CP850"
|
||||
echo "nl_NL CP850"
|
||||
echo "nn CP865" # not CP850 ??
|
||||
echo "nn_NO CP865" # not CP850 ??
|
||||
echo "no CP865" # not CP850 ??
|
||||
echo "no_NO CP865" # not CP850 ??
|
||||
echo "pt CP850"
|
||||
echo "pt_BR CP850"
|
||||
echo "pt_PT CP850"
|
||||
echo "sv CP850"
|
||||
echo "sv_SE CP850"
|
||||
# ISO-8859-2 languages
|
||||
echo "cs CP852"
|
||||
echo "cs_CZ CP852"
|
||||
echo "hr CP852"
|
||||
echo "hr_HR CP852"
|
||||
echo "hu CP852"
|
||||
echo "hu_HU CP852"
|
||||
echo "pl CP852"
|
||||
echo "pl_PL CP852"
|
||||
echo "ro CP852"
|
||||
echo "ro_RO CP852"
|
||||
echo "sk CP852"
|
||||
echo "sk_SK CP852"
|
||||
echo "sl CP852"
|
||||
echo "sl_SI CP852"
|
||||
echo "sq CP852"
|
||||
echo "sq_AL CP852"
|
||||
echo "sr CP852" # CP852 or CP866 or CP855 ??
|
||||
echo "sr_YU CP852" # CP852 or CP866 or CP855 ??
|
||||
# ISO-8859-3 languages
|
||||
echo "mt CP850"
|
||||
echo "mt_MT CP850"
|
||||
# ISO-8859-5 languages
|
||||
echo "be CP866"
|
||||
echo "be_BE CP866"
|
||||
echo "bg CP866" # not CP855 ??
|
||||
echo "bg_BG CP866" # not CP855 ??
|
||||
echo "mk CP866" # not CP855 ??
|
||||
echo "mk_MK CP866" # not CP855 ??
|
||||
echo "ru CP866"
|
||||
echo "ru_RU CP866"
|
||||
echo "uk CP1125"
|
||||
echo "uk_UA CP1125"
|
||||
# ISO-8859-6 languages
|
||||
echo "ar CP864"
|
||||
echo "ar_AE CP864"
|
||||
echo "ar_DZ CP864"
|
||||
echo "ar_EG CP864"
|
||||
echo "ar_IQ CP864"
|
||||
echo "ar_IR CP864"
|
||||
echo "ar_JO CP864"
|
||||
echo "ar_KW CP864"
|
||||
echo "ar_MA CP864"
|
||||
echo "ar_OM CP864"
|
||||
echo "ar_QA CP864"
|
||||
echo "ar_SA CP864"
|
||||
echo "ar_SY CP864"
|
||||
# ISO-8859-7 languages
|
||||
echo "el CP869"
|
||||
echo "el_GR CP869"
|
||||
# ISO-8859-8 languages
|
||||
echo "he CP862"
|
||||
echo "he_IL CP862"
|
||||
# ISO-8859-9 languages
|
||||
echo "tr CP857"
|
||||
echo "tr_TR CP857"
|
||||
# Japanese
|
||||
echo "ja CP932"
|
||||
echo "ja_JP CP932"
|
||||
# Chinese
|
||||
echo "zh_CN GBK"
|
||||
echo "zh_TW CP950" # not CP938 ??
|
||||
# Korean
|
||||
echo "kr CP949" # not CP934 ??
|
||||
echo "kr_KR CP949" # not CP934 ??
|
||||
# Thai
|
||||
echo "th CP874"
|
||||
echo "th_TH CP874"
|
||||
# Other
|
||||
echo "eo CP850"
|
||||
echo "eo_EO CP850"
|
||||
;;
|
||||
esac
|
||||
@@ -1,311 +0,0 @@
|
||||
/* libgnuintl.h - Message catalogs for internationalization. */
|
||||
|
||||
/* Copyright (C) 1995-1997, 2000-2003, 2004-2009 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash.
|
||||
|
||||
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 3 of the License, 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. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _LIBINTL_H
|
||||
#define _LIBINTL_H 1
|
||||
|
||||
#include <locale.h>
|
||||
|
||||
/* The LC_MESSAGES locale category is the category used by the functions
|
||||
gettext() and dgettext(). It is specified in POSIX, but not in ANSI C.
|
||||
On systems that don't define it, use an arbitrary value instead.
|
||||
On Solaris, <locale.h> defines __LOCALE_H (or _LOCALE_H in Solaris 2.5)
|
||||
then includes <libintl.h> (i.e. this file!) and then only defines
|
||||
LC_MESSAGES. To avoid a redefinition warning, don't define LC_MESSAGES
|
||||
in this case. */
|
||||
#if !defined LC_MESSAGES && !(defined __LOCALE_H || (defined _LOCALE_H && defined __sun))
|
||||
# define LC_MESSAGES 1729
|
||||
#endif
|
||||
|
||||
/* We define an additional symbol to signal that we use the GNU
|
||||
implementation of gettext. */
|
||||
#define __USE_GNU_GETTEXT 1
|
||||
|
||||
/* Provide information about the supported file formats. Returns the
|
||||
maximum minor revision number supported for a given major revision. */
|
||||
#define __GNU_GETTEXT_SUPPORTED_REVISION(major) \
|
||||
((major) == 0 ? 1 : -1)
|
||||
|
||||
/* Resolve a platform specific conflict on DJGPP. GNU gettext takes
|
||||
precedence over _conio_gettext. */
|
||||
#ifdef __DJGPP__
|
||||
# undef gettext
|
||||
#endif
|
||||
|
||||
/* Use _INTL_PARAMS, not PARAMS, in order to avoid clashes with identifiers
|
||||
used by programs. Similarly, test __PROTOTYPES, not PROTOTYPES. */
|
||||
#ifndef _INTL_PARAMS
|
||||
# if __STDC__ || defined __GNUC__ || defined __SUNPRO_C || defined __cplusplus || __PROTOTYPES
|
||||
# define _INTL_PARAMS(args) args
|
||||
# else
|
||||
# define _INTL_PARAMS(args) ()
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/* We redirect the functions to those prefixed with "libintl_". This is
|
||||
necessary, because some systems define gettext/textdomain/... in the C
|
||||
library (namely, Solaris 2.4 and newer, and GNU libc 2.0 and newer).
|
||||
If we used the unprefixed names, there would be cases where the
|
||||
definition in the C library would override the one in the libintl.so
|
||||
shared library. Recall that on ELF systems, the symbols are looked
|
||||
up in the following order:
|
||||
1. in the executable,
|
||||
2. in the shared libraries specified on the link command line, in order,
|
||||
3. in the dependencies of the shared libraries specified on the link
|
||||
command line,
|
||||
4. in the dlopen()ed shared libraries, in the order in which they were
|
||||
dlopen()ed.
|
||||
The definition in the C library would override the one in libintl.so if
|
||||
either
|
||||
* -lc is given on the link command line and -lintl isn't, or
|
||||
* -lc is given on the link command line before -lintl, or
|
||||
* libintl.so is a dependency of a dlopen()ed shared library but not
|
||||
linked to the executable at link time.
|
||||
Since Solaris gettext() behaves differently than GNU gettext(), this
|
||||
would be unacceptable.
|
||||
|
||||
The redirection happens by default through macros in C, so that &gettext
|
||||
is independent of the compilation unit, but through inline functions in
|
||||
C++, in order not to interfere with the name mangling of class fields or
|
||||
class methods called 'gettext'. */
|
||||
|
||||
/* The user can define _INTL_REDIRECT_INLINE or _INTL_REDIRECT_MACROS.
|
||||
If he doesn't, we choose the method. A third possible method is
|
||||
_INTL_REDIRECT_ASM, supported only by GCC. */
|
||||
#if !(defined _INTL_REDIRECT_INLINE || defined _INTL_REDIRECT_MACROS)
|
||||
# if __GNUC__ >= 2 && !defined __APPLE_CC__ && (defined __STDC__ || defined __cplusplus)
|
||||
# define _INTL_REDIRECT_ASM
|
||||
# else
|
||||
# ifdef __cplusplus
|
||||
# define _INTL_REDIRECT_INLINE
|
||||
# else
|
||||
# define _INTL_REDIRECT_MACROS
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
/* Auxiliary macros. */
|
||||
#ifdef _INTL_REDIRECT_ASM
|
||||
# define _INTL_ASM(cname) __asm__ (_INTL_ASMNAME (__USER_LABEL_PREFIX__, #cname))
|
||||
# define _INTL_ASMNAME(prefix,cnamestring) _INTL_STRINGIFY (prefix) cnamestring
|
||||
# define _INTL_STRINGIFY(prefix) #prefix
|
||||
#else
|
||||
# define _INTL_ASM(cname)
|
||||
#endif
|
||||
|
||||
/* Look up MSGID in the current default message catalog for the current
|
||||
LC_MESSAGES locale. If not found, returns MSGID itself (the default
|
||||
text). */
|
||||
#ifdef _INTL_REDIRECT_INLINE
|
||||
extern char *libintl_gettext (const char *__msgid);
|
||||
static inline char *gettext (const char *__msgid)
|
||||
{
|
||||
return libintl_gettext (__msgid);
|
||||
}
|
||||
#else
|
||||
#ifdef _INTL_REDIRECT_MACROS
|
||||
# define gettext libintl_gettext
|
||||
#endif
|
||||
extern char *gettext _INTL_PARAMS ((const char *__msgid))
|
||||
_INTL_ASM (libintl_gettext);
|
||||
#endif
|
||||
|
||||
/* Look up MSGID in the DOMAINNAME message catalog for the current
|
||||
LC_MESSAGES locale. */
|
||||
#ifdef _INTL_REDIRECT_INLINE
|
||||
extern char *libintl_dgettext (const char *__domainname, const char *__msgid);
|
||||
static inline char *dgettext (const char *__domainname, const char *__msgid)
|
||||
{
|
||||
return libintl_dgettext (__domainname, __msgid);
|
||||
}
|
||||
#else
|
||||
#ifdef _INTL_REDIRECT_MACROS
|
||||
# define dgettext libintl_dgettext
|
||||
#endif
|
||||
extern char *dgettext _INTL_PARAMS ((const char *__domainname,
|
||||
const char *__msgid))
|
||||
_INTL_ASM (libintl_dgettext);
|
||||
#endif
|
||||
|
||||
/* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY
|
||||
locale. */
|
||||
#ifdef _INTL_REDIRECT_INLINE
|
||||
extern char *libintl_dcgettext (const char *__domainname, const char *__msgid,
|
||||
int __category);
|
||||
static inline char *dcgettext (const char *__domainname, const char *__msgid,
|
||||
int __category)
|
||||
{
|
||||
return libintl_dcgettext (__domainname, __msgid, __category);
|
||||
}
|
||||
#else
|
||||
#ifdef _INTL_REDIRECT_MACROS
|
||||
# define dcgettext libintl_dcgettext
|
||||
#endif
|
||||
extern char *dcgettext _INTL_PARAMS ((const char *__domainname,
|
||||
const char *__msgid,
|
||||
int __category))
|
||||
_INTL_ASM (libintl_dcgettext);
|
||||
#endif
|
||||
|
||||
|
||||
/* Similar to `gettext' but select the plural form corresponding to the
|
||||
number N. */
|
||||
#ifdef _INTL_REDIRECT_INLINE
|
||||
extern char *libintl_ngettext (const char *__msgid1, const char *__msgid2,
|
||||
unsigned long int __n);
|
||||
static inline char *ngettext (const char *__msgid1, const char *__msgid2,
|
||||
unsigned long int __n)
|
||||
{
|
||||
return libintl_ngettext (__msgid1, __msgid2, __n);
|
||||
}
|
||||
#else
|
||||
#ifdef _INTL_REDIRECT_MACROS
|
||||
# define ngettext libintl_ngettext
|
||||
#endif
|
||||
extern char *ngettext _INTL_PARAMS ((const char *__msgid1,
|
||||
const char *__msgid2,
|
||||
unsigned long int __n))
|
||||
_INTL_ASM (libintl_ngettext);
|
||||
#endif
|
||||
|
||||
/* Similar to `dgettext' but select the plural form corresponding to the
|
||||
number N. */
|
||||
#ifdef _INTL_REDIRECT_INLINE
|
||||
extern char *libintl_dngettext (const char *__domainname, const char *__msgid1,
|
||||
const char *__msgid2, unsigned long int __n);
|
||||
static inline char *dngettext (const char *__domainname, const char *__msgid1,
|
||||
const char *__msgid2, unsigned long int __n)
|
||||
{
|
||||
return libintl_dngettext (__domainname, __msgid1, __msgid2, __n);
|
||||
}
|
||||
#else
|
||||
#ifdef _INTL_REDIRECT_MACROS
|
||||
# define dngettext libintl_dngettext
|
||||
#endif
|
||||
extern char *dngettext _INTL_PARAMS ((const char *__domainname,
|
||||
const char *__msgid1,
|
||||
const char *__msgid2,
|
||||
unsigned long int __n))
|
||||
_INTL_ASM (libintl_dngettext);
|
||||
#endif
|
||||
|
||||
/* Similar to `dcgettext' but select the plural form corresponding to the
|
||||
number N. */
|
||||
#ifdef _INTL_REDIRECT_INLINE
|
||||
extern char *libintl_dcngettext (const char *__domainname,
|
||||
const char *__msgid1, const char *__msgid2,
|
||||
unsigned long int __n, int __category);
|
||||
static inline char *dcngettext (const char *__domainname,
|
||||
const char *__msgid1, const char *__msgid2,
|
||||
unsigned long int __n, int __category)
|
||||
{
|
||||
return libintl_dcngettext (__domainname, __msgid1, __msgid2, __n, __category);
|
||||
}
|
||||
#else
|
||||
#ifdef _INTL_REDIRECT_MACROS
|
||||
# define dcngettext libintl_dcngettext
|
||||
#endif
|
||||
extern char *dcngettext _INTL_PARAMS ((const char *__domainname,
|
||||
const char *__msgid1,
|
||||
const char *__msgid2,
|
||||
unsigned long int __n,
|
||||
int __category))
|
||||
_INTL_ASM (libintl_dcngettext);
|
||||
#endif
|
||||
|
||||
|
||||
/* Set the current default message catalog to DOMAINNAME.
|
||||
If DOMAINNAME is null, return the current default.
|
||||
If DOMAINNAME is "", reset to the default of "messages". */
|
||||
#ifdef _INTL_REDIRECT_INLINE
|
||||
extern char *libintl_textdomain (const char *__domainname);
|
||||
static inline char *textdomain (const char *__domainname)
|
||||
{
|
||||
return libintl_textdomain (__domainname);
|
||||
}
|
||||
#else
|
||||
#ifdef _INTL_REDIRECT_MACROS
|
||||
# define textdomain libintl_textdomain
|
||||
#endif
|
||||
extern char *textdomain _INTL_PARAMS ((const char *__domainname))
|
||||
_INTL_ASM (libintl_textdomain);
|
||||
#endif
|
||||
|
||||
/* Specify that the DOMAINNAME message catalog will be found
|
||||
in DIRNAME rather than in the system locale data base. */
|
||||
#ifdef _INTL_REDIRECT_INLINE
|
||||
extern char *libintl_bindtextdomain (const char *__domainname,
|
||||
const char *__dirname);
|
||||
static inline char *bindtextdomain (const char *__domainname,
|
||||
const char *__dirname)
|
||||
{
|
||||
return libintl_bindtextdomain (__domainname, __dirname);
|
||||
}
|
||||
#else
|
||||
#ifdef _INTL_REDIRECT_MACROS
|
||||
# define bindtextdomain libintl_bindtextdomain
|
||||
#endif
|
||||
extern char *bindtextdomain _INTL_PARAMS ((const char *__domainname,
|
||||
const char *__dirname))
|
||||
_INTL_ASM (libintl_bindtextdomain);
|
||||
#endif
|
||||
|
||||
/* Specify the character encoding in which the messages from the
|
||||
DOMAINNAME message catalog will be returned. */
|
||||
#ifdef _INTL_REDIRECT_INLINE
|
||||
extern char *libintl_bind_textdomain_codeset (const char *__domainname,
|
||||
const char *__codeset);
|
||||
static inline char *bind_textdomain_codeset (const char *__domainname,
|
||||
const char *__codeset)
|
||||
{
|
||||
return libintl_bind_textdomain_codeset (__domainname, __codeset);
|
||||
}
|
||||
#else
|
||||
#ifdef _INTL_REDIRECT_MACROS
|
||||
# define bind_textdomain_codeset libintl_bind_textdomain_codeset
|
||||
#endif
|
||||
extern char *bind_textdomain_codeset _INTL_PARAMS ((const char *__domainname,
|
||||
const char *__codeset))
|
||||
_INTL_ASM (libintl_bind_textdomain_codeset);
|
||||
#endif
|
||||
|
||||
|
||||
/* Support for relocatable packages. */
|
||||
|
||||
/* Sets the original and the current installation prefix of the package.
|
||||
Relocation simply replaces a pathname starting with the original prefix
|
||||
by the corresponding pathname with the current prefix instead. Both
|
||||
prefixes should be directory names without trailing slash (i.e. use ""
|
||||
instead of "/"). */
|
||||
#define libintl_set_relocation_prefix libintl_set_relocation_prefix
|
||||
extern void
|
||||
libintl_set_relocation_prefix _INTL_PARAMS ((const char *orig_prefix,
|
||||
const char *curr_prefix));
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* libintl.h */
|
||||
@@ -1,78 +0,0 @@
|
||||
# locale.alias - Locale name alias data base.
|
||||
#
|
||||
# Copyright (C) 1996,1997,1998,1999,2000,2001,2005-2009 Free Software Foundation, Inc.
|
||||
#
|
||||
# This program 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.
|
||||
#
|
||||
# This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
# The format of this file is the same as for the corresponding file of
|
||||
# the X Window System, which normally can be found in
|
||||
# /usr/lib/X11/locale/locale.alias
|
||||
# A single line contains two fields: an alias and a substitution value.
|
||||
# All entries are case independent.
|
||||
|
||||
# Note: This file is far from being complete. If you have a value for
|
||||
# your own site which you think might be useful for others too, share
|
||||
# it with the rest of us. Send it using the `glibcbug' script to
|
||||
# bugs@gnu.org.
|
||||
|
||||
# Packages using this file:
|
||||
|
||||
bokmal no_NO.ISO-8859-1
|
||||
bokmål no_NO.ISO-8859-1
|
||||
catalan ca_ES.ISO-8859-1
|
||||
croatian hr_HR.ISO-8859-2
|
||||
czech cs_CZ.ISO-8859-2
|
||||
danish da_DK.ISO-8859-1
|
||||
dansk da_DK.ISO-8859-1
|
||||
deutsch de_DE.ISO-8859-1
|
||||
dutch nl_NL.ISO-8859-1
|
||||
eesti et_EE.ISO-8859-1
|
||||
estonian et_EE.ISO-8859-1
|
||||
finnish fi_FI.ISO-8859-1
|
||||
français fr_FR.ISO-8859-1
|
||||
french fr_FR.ISO-8859-1
|
||||
galego gl_ES.ISO-8859-1
|
||||
galician gl_ES.ISO-8859-1
|
||||
german de_DE.ISO-8859-1
|
||||
greek el_GR.ISO-8859-7
|
||||
hebrew he_IL.ISO-8859-8
|
||||
hrvatski hr_HR.ISO-8859-2
|
||||
hungarian hu_HU.ISO-8859-2
|
||||
icelandic is_IS.ISO-8859-1
|
||||
italian it_IT.ISO-8859-1
|
||||
japanese ja_JP.eucJP
|
||||
japanese.euc ja_JP.eucJP
|
||||
ja_JP ja_JP.eucJP
|
||||
ja_JP.ujis ja_JP.eucJP
|
||||
japanese.sjis ja_JP.SJIS
|
||||
korean ko_KR.eucKR
|
||||
korean.euc ko_KR.eucKR
|
||||
ko_KR ko_KR.eucKR
|
||||
lithuanian lt_LT.ISO-8859-13
|
||||
nb_NO no_NO.ISO-8859-1
|
||||
nb_NO.ISO-8859-1 no_NO.ISO-8859-1
|
||||
norwegian no_NO.ISO-8859-1
|
||||
nynorsk nn_NO.ISO-8859-1
|
||||
polish pl_PL.ISO-8859-2
|
||||
portuguese pt_PT.ISO-8859-1
|
||||
romanian ro_RO.ISO-8859-2
|
||||
russian ru_RU.ISO-8859-5
|
||||
slovak sk_SK.ISO-8859-2
|
||||
slovene sl_SI.ISO-8859-2
|
||||
slovenian sl_SI.ISO-8859-2
|
||||
spanish es_ES.ISO-8859-1
|
||||
swedish sv_SE.ISO-8859-1
|
||||
thai th_TH.TIS-620
|
||||
turkish tr_TR.ISO-8859-9
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
/* malloc.c - dynamic memory allocation for bash. */
|
||||
|
||||
/* Copyright (C) 1985-2022 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1985-2025 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne-Again SHell.
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
/* table.h - definitions for tables for keeping track of allocated memory */
|
||||
|
||||
/* Copyright (C) 2001-2022 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 2001-2025 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne-Again SHell.
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* complete.c -- filename completion for readline. */
|
||||
|
||||
/* Copyright (C) 1987-2024 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1987-2025 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.
|
||||
@@ -3066,7 +3066,10 @@ _rl_export_completions (char **matches, char *text, int start, int end)
|
||||
fprintf (rl_outstream, "%s\n", text);
|
||||
fprintf (rl_outstream, "%d:%d\n", start, end); /* : because it's not a radix character */
|
||||
for (i = 0; i < len; i++)
|
||||
fprintf (rl_outstream, "%s\n", matches[i]);
|
||||
{
|
||||
print_filename (matches[i], matches[i], 0);
|
||||
fprintf (rl_outstream, "\n");
|
||||
}
|
||||
fflush (rl_outstream);
|
||||
}
|
||||
|
||||
|
||||
+46
-21
@@ -1,6 +1,6 @@
|
||||
/* display.c -- readline redisplay facility. */
|
||||
|
||||
/* Copyright (C) 1987-2024 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1987-2025 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.
|
||||
@@ -1489,7 +1489,7 @@ rl_redisplay (void)
|
||||
but the buffer position needs to be adjusted to account
|
||||
for invisible characters. */
|
||||
if ((mb_cur_max == 1 || rl_byte_oriented) && cursor_linenum == prompt_last_screen_line)
|
||||
_rl_last_c_pos = physpos + WRAP_OFFSET (cursor_linenum, wrap_offset);;
|
||||
_rl_last_c_pos = physpos + WRAP_OFFSET (cursor_linenum, wrap_offset);
|
||||
}
|
||||
|
||||
/* Now we move the cursor to where it needs to be. First, make
|
||||
@@ -1502,28 +1502,53 @@ rl_redisplay (void)
|
||||
invisible character in the prompt string. */
|
||||
/* XXX - why not use local_prompt_len? */
|
||||
nleft = prompt_visible_length + wrap_offset;
|
||||
if (cursor_linenum == prompt_last_screen_line && wrap_offset > 0 &&
|
||||
_rl_last_c_pos > 0 && local_prompt &&
|
||||
_rl_last_c_pos < PROMPT_ENDING_INDEX)
|
||||
if (cursor_linenum == prompt_last_screen_line)
|
||||
{
|
||||
int pmt_offset;
|
||||
int pmt_offset = local_prompt_newlines ? local_prompt_newlines[cursor_linenum] : 0;
|
||||
int curline_invchars = local_prompt_invis_chars ? local_prompt_invis_chars[cursor_linenum] : wrap_offset;
|
||||
int cursor_bufpos;
|
||||
|
||||
_rl_cr ();
|
||||
if (modmark)
|
||||
_rl_output_some_chars ("*", 1);
|
||||
/* cursor_bufpos is where the portion of the prompt that appears
|
||||
on the current screen line begins in the buffer. It is a
|
||||
buffer position, an index into curline
|
||||
(local_prompt + pmt_offset) */
|
||||
cursor_bufpos = pmt_offset;
|
||||
if (mb_cur_max == 1 || rl_byte_oriented)
|
||||
cursor_bufpos += _rl_last_c_pos;
|
||||
else
|
||||
cursor_bufpos += _rl_last_c_pos + curline_invchars;
|
||||
|
||||
/* If the number of characters in local_prompt is greater than
|
||||
the screen width, the prompt wraps. We only want to print the
|
||||
portion after the line wrap. */
|
||||
pmt_offset = local_prompt_newlines[cursor_linenum];
|
||||
if (cursor_linenum > 0 && pmt_offset > 0 && nleft > pmt_offset)
|
||||
_rl_output_some_chars (local_prompt + pmt_offset, nleft - pmt_offset);
|
||||
else
|
||||
_rl_output_some_chars (local_prompt, nleft);
|
||||
if (mb_cur_max > 1 && rl_byte_oriented == 0)
|
||||
_rl_last_c_pos = _rl_col_width (local_prompt, 0, nleft, 1) - wrap_offset + modmark;
|
||||
else
|
||||
_rl_last_c_pos = nleft + modmark; /* buffer position */
|
||||
if (local_prompt && local_prompt_invis_chars[cursor_linenum] &&
|
||||
_rl_last_c_pos > 0 &&
|
||||
cursor_bufpos <= prompt_last_invisible)
|
||||
{
|
||||
_rl_cr ();
|
||||
if (modmark)
|
||||
_rl_output_some_chars ("*", 1);
|
||||
|
||||
/* If the number of characters in local_prompt is greater
|
||||
than the screen width, the prompt wraps. We only want to
|
||||
print the portion after the line wrap. */
|
||||
|
||||
/* Make sure we set _rl_last_c_pos based on the number of
|
||||
characters we actually output, since we start at column 0. */
|
||||
if (cursor_linenum > 0 && pmt_offset > 0 && nleft > pmt_offset)
|
||||
_rl_output_some_chars (local_prompt + pmt_offset, nleft - pmt_offset);
|
||||
else
|
||||
{
|
||||
_rl_output_some_chars (local_prompt, nleft);
|
||||
pmt_offset = 0; /* force for calculation below */
|
||||
}
|
||||
|
||||
if (mb_cur_max > 1 && rl_byte_oriented == 0)
|
||||
/* Start width calculation where we started output. */
|
||||
_rl_last_c_pos = _rl_col_width (local_prompt, pmt_offset, nleft, 1) - WRAP_OFFSET(cursor_linenum, wrap_offset) + modmark;
|
||||
else
|
||||
/* Index into invisible_line+inv_lbreaks[cursor_linenum],
|
||||
since that's what we use in the call to
|
||||
_rl_move_cursor_relative below. */
|
||||
_rl_last_c_pos = nleft + modmark - inv_lbreaks[cursor_linenum]; /* buffer position */
|
||||
}
|
||||
}
|
||||
|
||||
/* Where on that line? And where does that line start
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
\input texinfo @c -*-texinfo-*-
|
||||
c\input texinfo @c -*-texinfo-*-
|
||||
@c %**start of header (This is for running Texinfo on a region.)
|
||||
@setfilename history.info
|
||||
@settitle GNU History Library
|
||||
@@ -12,7 +12,7 @@ This document describes the GNU History library
|
||||
a programming tool that provides a consistent user interface for
|
||||
recalling lines of previously typed input.
|
||||
|
||||
Copyright @copyright{} 1988--2024 Free Software Foundation, Inc.
|
||||
Copyright @copyright{} 1988--2025 Free Software Foundation, Inc.
|
||||
|
||||
@quotation
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
@ignore
|
||||
This file documents the user interface to the GNU History library.
|
||||
|
||||
Copyright (C) 1988-2024 Free Software Foundation, Inc.
|
||||
Copyright (C) 1988-2025 Free Software Foundation, Inc.
|
||||
Authored by Brian Fox and Chet Ramey.
|
||||
|
||||
Permission is granted to make and distribute verbatim copies of this manual
|
||||
@@ -36,7 +36,7 @@ For information on the interactive use of @sc{gnu} History,
|
||||
* Introduction to History:: What is the GNU History library for?
|
||||
* History Storage:: How information is stored.
|
||||
* History Functions:: Functions that you can use.
|
||||
* History Variables:: Variables that control behaviour.
|
||||
* History Variables:: Variables that control behavior.
|
||||
* History Programming Example:: Example of using the GNU History Library.
|
||||
@end menu
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
@ignore
|
||||
This file documents the user interface to the GNU History library.
|
||||
|
||||
Copyright (C) 1988--2024 Free Software Foundation, Inc.
|
||||
Copyright (C) 1988--2025 Free Software Foundation, Inc.
|
||||
Authored by Brian Fox and Chet Ramey.
|
||||
|
||||
Permission is granted to make and distribute verbatim copies of this manual
|
||||
@@ -504,6 +504,8 @@ It may be omitted if the word designator begins with a @samp{^}, @samp{$},
|
||||
@samp{*}, @samp{-}, or @samp{%}.
|
||||
Words are numbered from the beginning of the line,
|
||||
with the first word being denoted by 0 (zero).
|
||||
That first word is usually the command word, and the arguments begin
|
||||
with the second word.
|
||||
Words are inserted into the current line separated by single spaces.
|
||||
|
||||
@need 0.75
|
||||
@@ -515,7 +517,7 @@ designates the preceding command.
|
||||
When you type this, the preceding command is repeated in toto.
|
||||
|
||||
@item !!:$
|
||||
designates the last argument of the preceding command.
|
||||
designates the last word of the preceding command.
|
||||
This may be shortened to @code{!$}.
|
||||
|
||||
@item !fi:2
|
||||
|
||||
@@ -13,7 +13,7 @@ This manual describes the GNU Readline Library
|
||||
consistency of user interface across discrete programs which provide
|
||||
a command line interface.
|
||||
|
||||
Copyright @copyright{} 1988--2024 Free Software Foundation, Inc.
|
||||
Copyright @copyright{} 1988--2025 Free Software Foundation, Inc.
|
||||
|
||||
@quotation
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
|
||||
@@ -7,7 +7,7 @@ This document describes the GNU Readline Library, a utility for aiding
|
||||
in the consistency of user interface across discrete programs that need
|
||||
to provide a command line interface.
|
||||
|
||||
Copyright (C) 1988--2024 Free Software Foundation, Inc.
|
||||
Copyright (C) 1988--2025 Free Software Foundation, Inc.
|
||||
|
||||
Permission is granted to make and distribute verbatim copies of
|
||||
this manual provided the copyright notice and this permission notice
|
||||
@@ -58,7 +58,7 @@ in your own programs, this section is for you.
|
||||
|
||||
Many programs provide a command line interface, such as @code{mail},
|
||||
@code{ftp}, and @code{sh}.
|
||||
For such programs, the default behaviour of Readline is sufficient.
|
||||
For such programs, the default behavior of Readline is sufficient.
|
||||
This section describes how to use Readline in
|
||||
the simplest way possible, perhaps to replace calls in your code to
|
||||
@code{fgets()}.
|
||||
@@ -149,7 +149,7 @@ rl_gets ()
|
||||
@}
|
||||
@end example
|
||||
|
||||
This function gives the user the default behaviour of @key{TAB}
|
||||
This function gives the user the default behavior of @key{TAB}
|
||||
completion: filename completion.
|
||||
If you do not want Readline to
|
||||
complete filenames, you can change the binding of the @key{TAB} key
|
||||
@@ -768,7 +768,7 @@ The caller should free @var{keymap}.
|
||||
|
||||
@deftypefun void rl_free_keymap (Keymap keymap)
|
||||
Free all storage associated with @var{keymap}.
|
||||
This calls @code{rl_discard_keymap} to free subordindate
|
||||
This calls @code{rl_discard_keymap} to free subordinate
|
||||
keymaps and macros.
|
||||
@end deftypefun
|
||||
|
||||
@@ -1168,7 +1168,7 @@ displaying a new message in the message area with @code{rl_message()}.
|
||||
@deftypefun void rl_restore_prompt (void)
|
||||
Restore the local Readline prompt display state saved by the most
|
||||
recent call to @code{rl_save_prompt}.
|
||||
if you called @code{rl_save_prompt} to save the prompt before a call
|
||||
If you called @code{rl_save_prompt} to save the prompt before a call
|
||||
to @code{rl_message}, you should call this function before the
|
||||
corresponding call to @code{rl_clear_message}.
|
||||
@end deftypefun
|
||||
|
||||
@@ -11,7 +11,7 @@ use these features. There is a document entitled "readline.texinfo"
|
||||
which contains both end-user and programmer documentation for the
|
||||
GNU Readline Library.
|
||||
|
||||
Copyright (C) 1988--2024 Free Software Foundation, Inc.
|
||||
Copyright (C) 1988--2025 Free Software Foundation, Inc.
|
||||
|
||||
Authored by Brian Fox and Chet Ramey.
|
||||
|
||||
@@ -466,9 +466,10 @@ A sample value might be @samp{\e[01;33m}.
|
||||
|
||||
@item active-region-end-color
|
||||
@vindex active-region-end-color
|
||||
A string variable that "undoes" the effects of @code{active-region-start-color}
|
||||
and restores "normal" terminal display appearance after displaying text
|
||||
in the active region.
|
||||
A string variable that ``undoes''
|
||||
the effects of @code{active-region-start-color}
|
||||
and restores ``normal''
|
||||
terminal display appearance after displaying text in the active region.
|
||||
This string must not take up any physical character positions on the display,
|
||||
so it should consist only of terminal escape sequences.
|
||||
It is output to the terminal after displaying the text in the active region.
|
||||
@@ -703,7 +704,7 @@ are saved.
|
||||
If set to a value less than zero, the number of history entries is not
|
||||
limited.
|
||||
@ifset BashFeatures
|
||||
By default, Bash sets the the maximum number of history entries to
|
||||
By default, Bash sets the maximum number of history entries to
|
||||
the value of the @code{HISTSIZE} shell variable.
|
||||
@end ifset
|
||||
@ifclear BashFeatures
|
||||
@@ -1055,7 +1056,7 @@ The eight-bit character whose value is the hexadecimal value @var{HH}
|
||||
When entering the text of a macro, single or double quotes must
|
||||
be used to indicate a macro definition.
|
||||
Unquoted text is assumed to be a function name.
|
||||
Tthe backslash escapes described above are expanded
|
||||
The backslash escapes described above are expanded
|
||||
in the macro body.
|
||||
Backslash will quote any other character in the macro text,
|
||||
including @samp{"} and @samp{'}.
|
||||
@@ -1188,7 +1189,7 @@ binding, variable assignment, and conditional syntax.
|
||||
|
||||
@example
|
||||
@page
|
||||
# This file controls the behaviour of line input editing for
|
||||
# This file controls the behavior of line input editing for
|
||||
# programs that use the GNU Readline library. Existing
|
||||
# programs include FTP, Bash, and GDB.
|
||||
#
|
||||
@@ -1316,10 +1317,13 @@ In the following descriptions, @dfn{point} refers to the current cursor
|
||||
position, and @dfn{mark} refers to a cursor position saved by the
|
||||
@code{set-mark} command.
|
||||
The text between the point and mark is referred to as the @dfn{region}.
|
||||
Readline has the concept of an @emph{active region}:
|
||||
Readline
|
||||
has the concept of an @emph{active region}:
|
||||
when the region is active,
|
||||
Readline redisplay highlights the region using the
|
||||
value of the @code{active-region-start-color} variable.
|
||||
value of the
|
||||
@code{active-region-start-color}
|
||||
variable.
|
||||
The @code{enable-active-region} variable turns this on and off.
|
||||
Several commands set the region to active; those are noted below.
|
||||
|
||||
@@ -1384,6 +1388,8 @@ leaving the current line at the top of the screen.
|
||||
Clear the screen,
|
||||
then redraw the current line,
|
||||
leaving the current line at the top of the screen.
|
||||
If given a numeric argument, this refreshes the current line
|
||||
without clearing the screen.
|
||||
|
||||
@item redraw-current-line ()
|
||||
Refresh the current line. By default, this is unbound.
|
||||
@@ -1806,7 +1812,7 @@ the number of matches @var{N};
|
||||
the word being completed;
|
||||
@item
|
||||
@var{S}:@var{E},
|
||||
where S and E are the start and end offsets of the word
|
||||
where @var{S} and @var{E} are the start and end offsets of the word
|
||||
in the Readline line buffer; then
|
||||
@item
|
||||
each match, one per line
|
||||
@@ -2057,7 +2063,7 @@ Expand the line by performing shell word expansions.
|
||||
This performs alias and history expansion,
|
||||
$'@var{string}' and $"@var{string}" quoting,
|
||||
tilde expansion, parameter and variable expansion, arithmetic expansion,
|
||||
command and proces substitution,
|
||||
command and process substitution,
|
||||
word splitting, and quote removal.
|
||||
An explicit argument suppresses command and process substitution.
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ This manual describes the end user interface of the GNU Readline Library
|
||||
consistency of user interface across discrete programs which provide
|
||||
a command line interface.
|
||||
|
||||
Copyright @copyright{} 1988--2024 Free Software Foundation, Inc.
|
||||
Copyright @copyright{} 1988--2025 Free Software Foundation, Inc.
|
||||
|
||||
@quotation
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
@ignore
|
||||
Copyright (C) 1988-2024 Free Software Foundation, Inc.
|
||||
Copyright (C) 1988-2025 Free Software Foundation, Inc.
|
||||
@end ignore
|
||||
|
||||
@set EDITION 8.3
|
||||
@set VERSION 8.3
|
||||
|
||||
@set UPDATED 29 November 2024
|
||||
@set UPDATED-MONTH November 2024
|
||||
@set UPDATED 30 December 2024
|
||||
@set UPDATED-MONTH December 2024
|
||||
|
||||
@set LASTCHANGE Fri Nov 29 18:18:20 EST 2024
|
||||
@set LASTCHANGE Mon Dec 30 11:27:03 EST 2024
|
||||
|
||||
@@ -141,7 +141,7 @@ get_history_event (const char *string, int *caller_index, int delimiting_quote)
|
||||
register char c;
|
||||
HIST_ENTRY *entry;
|
||||
int which, sign, local_index, substring_okay;
|
||||
int search_flags;
|
||||
int search_flags, old_offset;
|
||||
char *temp;
|
||||
|
||||
/* The event can be specified in a number of ways.
|
||||
@@ -251,9 +251,10 @@ get_history_event (const char *string, int *caller_index, int delimiting_quote)
|
||||
|
||||
*caller_index = i;
|
||||
|
||||
old_offset = history_offset; /* XXX */
|
||||
#define FAIL_SEARCH() \
|
||||
do { \
|
||||
history_offset = history_length; xfree (temp) ; return (char *)NULL; \
|
||||
history_offset = old_offset; xfree (temp) ; return (char *)NULL; \
|
||||
} while (0)
|
||||
|
||||
/* If there is no search string, try to use the previous search string,
|
||||
@@ -282,7 +283,7 @@ get_history_event (const char *string, int *caller_index, int delimiting_quote)
|
||||
entry = current_history ();
|
||||
if (entry == 0)
|
||||
FAIL_SEARCH ();
|
||||
history_offset = history_length;
|
||||
history_offset = old_offset; /* XXX - was history_length */
|
||||
|
||||
/* If this was a substring search, then remember the
|
||||
string that we matched for word substitution. */
|
||||
|
||||
+17
-14
@@ -1,6 +1,6 @@
|
||||
/* histfile.c - functions to manipulate the history file. */
|
||||
|
||||
/* Copyright (C) 1989-2019,2023-2024 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1989-2019,2023-2025 Free Software Foundation, Inc.
|
||||
|
||||
This file contains the GNU History Library (History), a set of
|
||||
routines for managing the text of previously typed lines.
|
||||
@@ -298,21 +298,24 @@ read_history_range (const char *filename, int from, int to)
|
||||
#endif
|
||||
goto error_and_exit;
|
||||
}
|
||||
|
||||
file_size = (size_t)finfo.st_size;
|
||||
|
||||
/* check for overflow on very large files */
|
||||
if (file_size != finfo.st_size || file_size + 1 < file_size)
|
||||
else
|
||||
{
|
||||
errno = overflow_errno;
|
||||
goto error_and_exit;
|
||||
}
|
||||
/* regular file */
|
||||
file_size = (size_t)finfo.st_size;
|
||||
|
||||
if (file_size == 0)
|
||||
{
|
||||
xfree (input);
|
||||
close (file);
|
||||
return 0; /* don't waste time if we don't have to */
|
||||
/* check for overflow on very large files */
|
||||
if (file_size != finfo.st_size || file_size + 1 < file_size)
|
||||
{
|
||||
errno = overflow_errno;
|
||||
goto error_and_exit;
|
||||
}
|
||||
|
||||
if (file_size == 0)
|
||||
{
|
||||
xfree (input);
|
||||
close (file);
|
||||
return 0; /* don't waste time if we don't have to */
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef HISTORY_USE_MMAP
|
||||
|
||||
@@ -90,4 +90,12 @@ getnow(void)
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
#ifndef TIMESPEC_TO_TIMEVAL
|
||||
# define TIMESPEC_TO_TIMEVAL(tv, ts) \
|
||||
do { \
|
||||
(tv)->tv_sec = (ts)->tv_sec; \
|
||||
(tv)->tv_usec = (tv)->tv_nsec / 1000; \
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
#endif /* _POSIXTIME_H_ */
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
+20
-20
@@ -148,26 +148,26 @@ _rl_wcwidth (WCHAR_T wc)
|
||||
{
|
||||
switch (wc)
|
||||
{
|
||||
case ' ': case '!': case '"': case '#': case '%':
|
||||
case '&': case '\'': case '(': case ')': case '*':
|
||||
case '+': case ',': case '-': case '.': case '/':
|
||||
case '0': case '1': case '2': case '3': case '4':
|
||||
case '5': case '6': case '7': case '8': case '9':
|
||||
case ':': case ';': case '<': case '=': case '>':
|
||||
case '?':
|
||||
case 'A': case 'B': case 'C': case 'D': case 'E':
|
||||
case 'F': case 'G': case 'H': case 'I': case 'J':
|
||||
case 'K': case 'L': case 'M': case 'N': case 'O':
|
||||
case 'P': case 'Q': case 'R': case 'S': case 'T':
|
||||
case 'U': case 'V': case 'W': case 'X': case 'Y':
|
||||
case 'Z':
|
||||
case '[': case '\\': case ']': case '^': case '_':
|
||||
case 'a': case 'b': case 'c': case 'd': case 'e':
|
||||
case 'f': case 'g': case 'h': case 'i': case 'j':
|
||||
case 'k': case 'l': case 'm': case 'n': case 'o':
|
||||
case 'p': case 'q': case 'r': case 's': case 't':
|
||||
case 'u': case 'v': case 'w': case 'x': case 'y':
|
||||
case 'z': case '{': case '|': case '}': case '~':
|
||||
case L' ': case L'!': case L'"': case L'#': case L'%':
|
||||
case L'&': case L'\'': case L'(': case L')': case L'*':
|
||||
case L'+': case L',': case L'-': case L'.': case L'/':
|
||||
case L'0': case L'1': case L'2': case L'3': case L'4':
|
||||
case L'5': case L'6': case L'7': case L'8': case L'9':
|
||||
case L':': case L';': case L'<': case L'=': case L'>':
|
||||
case L'?':
|
||||
case L'A': case L'B': case L'C': case L'D': case L'E':
|
||||
case L'F': case L'G': case L'H': case L'I': case L'J':
|
||||
case L'K': case L'L': case L'M': case L'N': case L'O':
|
||||
case L'P': case L'Q': case L'R': case L'S': case L'T':
|
||||
case L'U': case L'V': case L'W': case L'X': case L'Y':
|
||||
case L'Z':
|
||||
case L'[': case L'\\': case L']': case L'^': case L'_':
|
||||
case L'a': case L'b': case L'c': case L'd': case L'e':
|
||||
case L'f': case L'g': case L'h': case L'i': case L'j':
|
||||
case L'k': case L'l': case L'm': case L'n': case L'o':
|
||||
case L'p': case L'q': case L'r': case L's': case L't':
|
||||
case L'u': case L'v': case L'w': case L'x': case L'y':
|
||||
case L'z': case L'{': case L'|': case L'}': case L'~':
|
||||
return 1;
|
||||
default:
|
||||
return wcwidth (wc);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* rlprivate.h -- functions and variables global to the readline library,
|
||||
but not intended for use by applications. */
|
||||
|
||||
/* Copyright (C) 1999-2024 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1999-2025 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.
|
||||
@@ -640,6 +640,7 @@ extern int _rl_history_search_pos;
|
||||
|
||||
/* signals.c */
|
||||
extern int volatile _rl_caught_signal;
|
||||
extern int volatile _rl_handling_signal;
|
||||
|
||||
extern _rl_sigcleanup_func_t *_rl_sigcleanup;
|
||||
extern void *_rl_sigcleanarg;
|
||||
|
||||
+15
-5
@@ -80,15 +80,25 @@ static int ksrflow;
|
||||
#endif
|
||||
|
||||
/* Dummy call to force a backgrounded readline to stop before it tries
|
||||
to get the tty settings. */
|
||||
to get the tty settings. But we use the information to set our idea
|
||||
of the screen size if we're in a signal handling context, since it
|
||||
doesn't make sense to waste it. */
|
||||
static void
|
||||
set_winsize (int tty)
|
||||
{
|
||||
#if defined (TIOCGWINSZ)
|
||||
#if defined (TIOCGWINSZ) || defined (HAVE_TCGETWINSIZE)
|
||||
struct winsize w;
|
||||
|
||||
if (ioctl (tty, TIOCGWINSZ, &w) == 0)
|
||||
(void) ioctl (tty, TIOCSWINSZ, &w);
|
||||
|
||||
if (_rl_tcgetwinsize (tty, &w) == 0)
|
||||
{
|
||||
(void) _rl_tcsetwinsize (tty, &w);
|
||||
/* We restrict this to the case where we're running a signal handler
|
||||
and executing after a SIGTSTP. We can relax it later. */
|
||||
#if defined (SIGTSTP)
|
||||
if (RL_ISSTATE (RL_STATE_SIGHANDLER) && _rl_handling_signal == SIGTSTP && rl_prefer_env_winsize == 0)
|
||||
_rl_set_screen_size (w.ws_row, w.ws_col); /* don't waste the info */
|
||||
#endif
|
||||
}
|
||||
#endif /* TIOCGWINSZ */
|
||||
}
|
||||
|
||||
|
||||
@@ -55,4 +55,7 @@
|
||||
# define tcflow(fd, action) ioctl(fd, TCXONC, action)
|
||||
#endif
|
||||
|
||||
extern int _rl_tcgetwinsize (int, struct winsize *);
|
||||
extern void _rl_tcsetwinsize (int, struct winsize *);
|
||||
|
||||
#endif /* _RL_WINSIZE_H */
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* signals.c -- signal handling support for readline. */
|
||||
|
||||
/* Copyright (C) 1987-2024 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1987-2025 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.
|
||||
@@ -88,6 +88,7 @@ int rl_catch_sigwinch = 0; /* for the readline state struct in readline.c */
|
||||
|
||||
/* Private variables. */
|
||||
int volatile _rl_caught_signal = 0; /* should be sig_atomic_t, but that requires including <signal.h> everywhere */
|
||||
int volatile _rl_handling_signal = 0;
|
||||
|
||||
/* If non-zero, print characters corresponding to received signals as long as
|
||||
the user has indicated his desire to do so (_rl_echo_control_chars). */
|
||||
@@ -133,6 +134,7 @@ _rl_signal_handler (int sig)
|
||||
if (sig == SIGWINCH)
|
||||
{
|
||||
RL_SETSTATE(RL_STATE_SIGHANDLER);
|
||||
_rl_handling_signal = SIGWINCH;
|
||||
|
||||
rl_resize_terminal ();
|
||||
/* XXX - experimental for now */
|
||||
@@ -142,6 +144,7 @@ _rl_signal_handler (int sig)
|
||||
if (rl_signal_event_hook)
|
||||
(*rl_signal_event_hook) ();
|
||||
|
||||
_rl_handling_signal = 0;
|
||||
RL_UNSETSTATE(RL_STATE_SIGHANDLER);
|
||||
}
|
||||
else
|
||||
@@ -177,6 +180,7 @@ _rl_handle_signal (int sig)
|
||||
#endif /* !HAVE_POSIX_SIGNALS */
|
||||
|
||||
RL_SETSTATE(RL_STATE_SIGHANDLER);
|
||||
_rl_handling_signal = sig;
|
||||
|
||||
#if !defined (HAVE_BSD_SIGNALS) && !defined (HAVE_POSIX_SIGNALS)
|
||||
/* Since the signal will not be blocked while we are in the signal
|
||||
@@ -301,6 +305,7 @@ _rl_handle_signal (int sig)
|
||||
rl_reset_after_signal ();
|
||||
}
|
||||
|
||||
_rl_handling_signal = 0;
|
||||
RL_UNSETSTATE(RL_STATE_SIGHANDLER);
|
||||
SIGHANDLER_RETURN;
|
||||
}
|
||||
|
||||
+29
-5
@@ -258,6 +258,30 @@ _win_get_screensize (int *swp, int *shp)
|
||||
}
|
||||
#endif
|
||||
|
||||
int
|
||||
_rl_tcgetwinsize (int tty, struct winsize *wp)
|
||||
{
|
||||
#if defined (HAVE_TCGETWINSIZE)
|
||||
return (tcgetwinsize (tty, wp));
|
||||
#elif defined (TIOCGWINSZ)
|
||||
return (ioctl (tty, TIOCGWINSZ, wp));
|
||||
#else
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
_rl_tcsetwinsize (int tty, struct winsize *wp)
|
||||
{
|
||||
#if defined (HAVE_TCGETWINSIZE)
|
||||
tcsetwinsize (tty, wp);
|
||||
#elif defined (TIOCGWINSZ)
|
||||
ioctl (tty, TIOCSWINSZ, wp);
|
||||
#else
|
||||
;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Get readline's idea of the screen size. TTY is a file descriptor open
|
||||
to the terminal. If IGNORE_ENV is true, we do not pay attention to the
|
||||
values of $LINES and $COLUMNS. The tests for TERM_STRING_BUFFER being
|
||||
@@ -266,19 +290,19 @@ void
|
||||
_rl_get_screen_size (int tty, int ignore_env)
|
||||
{
|
||||
char *ss;
|
||||
#if defined (TIOCGWINSZ)
|
||||
#if defined (TIOCGWINSZ) || defined (HAVE_TCGETWINSIZE)
|
||||
struct winsize window_size;
|
||||
#endif /* TIOCGWINSZ */
|
||||
#endif /* TIOCGWINSZ || HAVE_TCGETWINSIZE */
|
||||
int wr, wc;
|
||||
|
||||
wr = wc = -1;
|
||||
#if defined (TIOCGWINSZ)
|
||||
if (ioctl (tty, TIOCGWINSZ, &window_size) == 0)
|
||||
#if defined (TIOCGWINSZ) || defined (HAVE_TCGETWINSIZE)
|
||||
if (_rl_tcgetwinsize (tty, &window_size) == 0)
|
||||
{
|
||||
wc = (int) window_size.ws_col;
|
||||
wr = (int) window_size.ws_row;
|
||||
}
|
||||
#endif /* TIOCGWINSZ */
|
||||
#endif /* TIOCGWINSZ || HAVE_TCGETWINSIZE */
|
||||
|
||||
#if defined (__EMX__)
|
||||
_emx_get_screensize (&wc, &wr);
|
||||
|
||||
@@ -112,6 +112,7 @@ _rl_abort_internal (void)
|
||||
RL_UNSETSTATE (RL_STATE_MULTIKEY); /* XXX */
|
||||
|
||||
rl_last_func = (rl_command_func_t *)NULL;
|
||||
_rl_command_to_execute = 0;
|
||||
|
||||
_rl_longjmp (_rl_top_level, 1);
|
||||
return (0);
|
||||
|
||||
+109
-37
@@ -1,59 +1,131 @@
|
||||
/* gettimeofday.c - gettimeofday replacement using time() */
|
||||
/* Provide gettimeofday for systems that don't have it or for which it's broken.
|
||||
|
||||
/* Copyright (C) 2020, 2022 Free Software Foundation, Inc.
|
||||
Copyright (C) 2001-2003, 2005-2007, 2009-2025 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
This file is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as
|
||||
published by the Free Software Foundation; either version 2.1 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
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 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Bash is distributed in the hope that it will be useful,
|
||||
This file 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.
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Bash. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
||||
|
||||
#include "config.h"
|
||||
/* written by Jim Meyering */
|
||||
|
||||
/* A version of gettimeofday that just sets tv_sec from time(3) on Unix-like
|
||||
systems that don't have it, or a version for Win32 systems. From gnulib */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#if !defined (HAVE_GETTIMEOFDAY)
|
||||
|
||||
#include "posixtime.h"
|
||||
#if HAVE_STDINT_H
|
||||
#include <stdint.h>
|
||||
|
||||
#if defined _WIN32 && ! defined __CYGWIN__
|
||||
# define WINDOWS_NATIVE
|
||||
# include <windows.h>
|
||||
#endif
|
||||
|
||||
/* A version of gettimeofday that just sets tv_sec from time(3) on Unix-like
|
||||
systems that don't have it, or a version for Win32 systems. */
|
||||
#ifdef WINDOWS_NATIVE
|
||||
|
||||
# if !(_WIN32_WINNT >= _WIN32_WINNT_WIN8)
|
||||
|
||||
/* Avoid warnings from gcc -Wcast-function-type. */
|
||||
# define GetProcAddress \
|
||||
(void *) GetProcAddress
|
||||
|
||||
/* GetSystemTimePreciseAsFileTime was introduced only in Windows 8. */
|
||||
typedef void (WINAPI * GetSystemTimePreciseAsFileTimeFuncType) (FILETIME *lpTime);
|
||||
static GetSystemTimePreciseAsFileTimeFuncType GetSystemTimePreciseAsFileTimeFunc = NULL;
|
||||
static BOOL initialized = FALSE;
|
||||
|
||||
static void
|
||||
initialize (void)
|
||||
{
|
||||
HMODULE kernel32 = LoadLibrary ("kernel32.dll");
|
||||
if (kernel32 != NULL)
|
||||
{
|
||||
GetSystemTimePreciseAsFileTimeFunc =
|
||||
(GetSystemTimePreciseAsFileTimeFuncType) GetProcAddress (kernel32, "GetSystemTimePreciseAsFileTime");
|
||||
}
|
||||
initialized = TRUE;
|
||||
}
|
||||
|
||||
# else /* !(_WIN32_WINNT >= _WIN32_WINNT_WIN8) */
|
||||
|
||||
# define GetSystemTimePreciseAsFileTimeFunc GetSystemTimePreciseAsFileTime
|
||||
|
||||
# endif /* !(_WIN32_WINNT >= _WIN32_WINNT_WIN8) */
|
||||
|
||||
#endif /* WINDOWS_NATIVE */
|
||||
|
||||
/* This is a wrapper for gettimeofday. It is used only on systems
|
||||
that lack this function, or whose implementation of this function
|
||||
causes problems.
|
||||
Work around the bug in some systems whereby gettimeofday clobbers
|
||||
the static buffer that localtime uses for its return value. The
|
||||
gettimeofday function from Mac OS X 10.0.4 (i.e., Darwin 1.3.7) has
|
||||
this problem. */
|
||||
|
||||
int
|
||||
gettimeofday (struct timeval *restrict tv, void *restrict tz)
|
||||
{
|
||||
#if !defined (_WIN32)
|
||||
tv->tv_sec = (time_t) time ((time_t *)0);
|
||||
tv->tv_usec = 0;
|
||||
#else
|
||||
/* EPOCH is the number of 100 nanosecond intervals from
|
||||
January 1, 1601 (UTC) to January 1, 1970.
|
||||
(the correct value has 9 trailing zeros) */
|
||||
static const uint64_t EPOCH = ((uint64_t) 116444736000000000ULL);
|
||||
#undef gettimeofday
|
||||
#ifdef WINDOWS_NATIVE
|
||||
|
||||
SYSTEMTIME system_time;
|
||||
FILETIME file_time;
|
||||
uint64_t time;
|
||||
/* On native Windows, there are two ways to get the current time:
|
||||
GetSystemTimeAsFileTime
|
||||
<https://docs.microsoft.com/en-us/windows/desktop/api/sysinfoapi/nf-sysinfoapi-getsystemtimeasfiletime>
|
||||
or
|
||||
GetSystemTimePreciseAsFileTime
|
||||
<https://docs.microsoft.com/en-us/windows/desktop/api/sysinfoapi/nf-sysinfoapi-getsystemtimepreciseasfiletime>.
|
||||
GetSystemTimeAsFileTime produces values that jump by increments of
|
||||
15.627 milliseconds (!) on average.
|
||||
Whereas GetSystemTimePreciseAsFileTime values usually jump by 1 or 2
|
||||
microseconds.
|
||||
More discussion on this topic:
|
||||
<http://www.windowstimestamp.com/description>. */
|
||||
FILETIME current_time;
|
||||
|
||||
GetSystemTime(&system_time);
|
||||
SystemTimeToFileTime(&system_time, &file_time);
|
||||
time = ((uint64_t)file_time.dwLowDateTime);
|
||||
time += ((uint64_t)file_time.dwHighDateTime) << 32;
|
||||
# if !(_WIN32_WINNT >= _WIN32_WINNT_WIN8)
|
||||
if (!initialized)
|
||||
initialize ();
|
||||
# endif
|
||||
if (GetSystemTimePreciseAsFileTimeFunc != NULL)
|
||||
GetSystemTimePreciseAsFileTimeFunc (¤t_time);
|
||||
else
|
||||
GetSystemTimeAsFileTime (¤t_time);
|
||||
|
||||
tp->tv_sec = (long) ((time - EPOCH) / 10000000L);
|
||||
tp->tv_usec = (long) (system_time.wMilliseconds * 1000);
|
||||
#endif
|
||||
/* Convert from FILETIME to 'struct timeval'. */
|
||||
/* FILETIME: <https://docs.microsoft.com/en-us/windows/desktop/api/minwinbase/ns-minwinbase-filetime> */
|
||||
ULONGLONG since_1601 =
|
||||
((ULONGLONG) current_time.dwHighDateTime << 32)
|
||||
| (ULONGLONG) current_time.dwLowDateTime;
|
||||
/* Between 1601-01-01 and 1970-01-01 there were 280 normal years and 89 leap
|
||||
years, in total 134774 days. */
|
||||
ULONGLONG since_1970 =
|
||||
since_1601 - (ULONGLONG) 134774 * (ULONGLONG) 86400 * (ULONGLONG) 10000000;
|
||||
ULONGLONG microseconds_since_1970 = since_1970 / (ULONGLONG) 10;
|
||||
*tv = (struct timeval) {
|
||||
.tv_sec = microseconds_since_1970 / (ULONGLONG) 1000000,
|
||||
.tv_usec = microseconds_since_1970 % (ULONGLONG) 1000000
|
||||
};
|
||||
|
||||
return 0;
|
||||
|
||||
#else /* !WINDOWS_NATIVE */
|
||||
|
||||
tv->tv_sec = (time_t) time ((time_t *)0);
|
||||
tv->tv_usec = 0;
|
||||
|
||||
return 0;
|
||||
|
||||
#endif /* !WINDOWS_NATIVE */
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !HAVE_GETTIMEOFDAY */
|
||||
|
||||
@@ -241,6 +241,8 @@ getmaxgroups (void)
|
||||
if (maxgroups > 0)
|
||||
return maxgroups;
|
||||
|
||||
/* can also use getgroups (0, NULL) */
|
||||
|
||||
#if defined (HAVE_SYSCONF) && defined (_SC_NGROUPS_MAX)
|
||||
maxgroups = sysconf (_SC_NGROUPS_MAX);
|
||||
#else
|
||||
|
||||
+207
-48
@@ -17,11 +17,15 @@
|
||||
* For VMS dates, add VMS_EXT.
|
||||
* For complete POSIX semantics, add POSIX_SEMANTICS.
|
||||
*
|
||||
* The code for %c, %x, and %X follows the C99 specification for
|
||||
* The code for %X follows the C99 specification for
|
||||
* the "C" locale.
|
||||
*
|
||||
* This version ignores LOCALE information.
|
||||
* It also doesn't worry about multi-byte characters.
|
||||
* The code for %c, and %x follows the C11 specification for
|
||||
* the "C" locale.
|
||||
*
|
||||
* With HAVE_NL_LANGINFO defined, locale-based values are used.
|
||||
*
|
||||
* This version doesn't worry about multi-byte characters.
|
||||
* So there.
|
||||
*
|
||||
* Arnold Robbins
|
||||
@@ -39,6 +43,8 @@
|
||||
* Updated December, 2001
|
||||
* Updated January, 2011
|
||||
* Updated April, 2012
|
||||
* Updated March, 2015
|
||||
* Updated June, 2015
|
||||
*
|
||||
* Fixes from ado@elsie.nci.nih.gov,
|
||||
* February 1991, May 1992
|
||||
@@ -61,6 +67,10 @@
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#if defined(TM_IN_SYS_TIME)
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <posixtime.h>
|
||||
@@ -82,6 +92,10 @@
|
||||
extern int errno;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_NL_LANGINFO
|
||||
#include <langinfo.h>
|
||||
#endif
|
||||
|
||||
#if defined (SHELL)
|
||||
extern char *get_string_value (const char *);
|
||||
#endif
|
||||
@@ -165,6 +179,146 @@ iso_8601_2000_year(char *buf, int year, size_t fw)
|
||||
}
|
||||
#endif /* POSIX_2008 */
|
||||
|
||||
/* days_a --- return the short name for the day of the week */
|
||||
|
||||
static const char *
|
||||
days_a(int index)
|
||||
{
|
||||
#ifdef HAVE_NL_LANGINFO
|
||||
static const nl_item data[] = {
|
||||
ABDAY_1,
|
||||
ABDAY_2,
|
||||
ABDAY_3,
|
||||
ABDAY_4,
|
||||
ABDAY_5,
|
||||
ABDAY_6,
|
||||
ABDAY_7,
|
||||
};
|
||||
|
||||
return nl_langinfo(data[index]);
|
||||
#else
|
||||
static const char *data[] = {
|
||||
"Sun", "Mon", "Tue", "Wed",
|
||||
"Thu", "Fri", "Sat",
|
||||
};
|
||||
|
||||
return data[index];
|
||||
#endif
|
||||
}
|
||||
|
||||
/* days_l --- return the long name for the day of the week */
|
||||
|
||||
static const char *
|
||||
days_l(int index)
|
||||
{
|
||||
#ifdef HAVE_NL_LANGINFO
|
||||
static const nl_item data[] = {
|
||||
DAY_1,
|
||||
DAY_2,
|
||||
DAY_3,
|
||||
DAY_4,
|
||||
DAY_5,
|
||||
DAY_6,
|
||||
DAY_7,
|
||||
};
|
||||
|
||||
return nl_langinfo(data[index]);
|
||||
#else
|
||||
static const char *data[] = {
|
||||
"Sunday", "Monday", "Tuesday", "Wednesday",
|
||||
"Thursday", "Friday", "Saturday",
|
||||
};
|
||||
|
||||
return data[index];
|
||||
#endif
|
||||
}
|
||||
|
||||
/* months_a --- return the short name for the month */
|
||||
|
||||
static const char *
|
||||
months_a(int index)
|
||||
{
|
||||
#ifdef HAVE_NL_LANGINFO
|
||||
static const nl_item data[] = {
|
||||
ABMON_1,
|
||||
ABMON_2,
|
||||
ABMON_3,
|
||||
ABMON_4,
|
||||
ABMON_5,
|
||||
ABMON_6,
|
||||
ABMON_7,
|
||||
ABMON_8,
|
||||
ABMON_9,
|
||||
ABMON_10,
|
||||
ABMON_11,
|
||||
ABMON_12,
|
||||
};
|
||||
|
||||
return nl_langinfo(data[index]);
|
||||
#else
|
||||
static const char *data[] = {
|
||||
"Jan", "Feb", "Mar", "Apr", "May", "Jun",
|
||||
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec",
|
||||
};
|
||||
|
||||
return data[index];
|
||||
#endif
|
||||
}
|
||||
|
||||
/* months_l --- return the short name for the month */
|
||||
|
||||
static const char *
|
||||
months_l(int index)
|
||||
{
|
||||
#ifdef HAVE_NL_LANGINFO
|
||||
static const nl_item data[] = {
|
||||
MON_1,
|
||||
MON_2,
|
||||
MON_3,
|
||||
MON_4,
|
||||
MON_5,
|
||||
MON_6,
|
||||
MON_7,
|
||||
MON_8,
|
||||
MON_9,
|
||||
MON_10,
|
||||
MON_11,
|
||||
MON_12,
|
||||
};
|
||||
|
||||
return nl_langinfo(data[index]);
|
||||
#else
|
||||
static const char *data[] = {
|
||||
"January", "February", "March", "April",
|
||||
"May", "June", "July", "August", "September",
|
||||
"October", "November", "December",
|
||||
};
|
||||
|
||||
return data[index];
|
||||
#endif
|
||||
}
|
||||
|
||||
/* days_a --- return am/pm string */
|
||||
|
||||
static const char *
|
||||
ampm(int index)
|
||||
{
|
||||
#ifdef HAVE_NL_LANGINFO
|
||||
static const nl_item data[] = {
|
||||
AM_STR,
|
||||
PM_STR,
|
||||
};
|
||||
|
||||
return nl_langinfo(data[index]);
|
||||
#else
|
||||
static const char *data[] = {
|
||||
"AM", "PM",
|
||||
};
|
||||
|
||||
return data[index];
|
||||
#endif
|
||||
}
|
||||
|
||||
/* strftime --- produce formatted time */
|
||||
|
||||
size_t
|
||||
@@ -199,27 +353,6 @@ strftime(char *s, size_t maxsize, const char *format, const struct tm *timeptr)
|
||||
char flag;
|
||||
#endif /* POSIX_2008 */
|
||||
|
||||
/* various tables, useful in North America */
|
||||
static const char *days_a[] = {
|
||||
"Sun", "Mon", "Tue", "Wed",
|
||||
"Thu", "Fri", "Sat",
|
||||
};
|
||||
static const char *days_l[] = {
|
||||
"Sunday", "Monday", "Tuesday", "Wednesday",
|
||||
"Thursday", "Friday", "Saturday",
|
||||
};
|
||||
static const char *months_a[] = {
|
||||
"Jan", "Feb", "Mar", "Apr", "May", "Jun",
|
||||
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec",
|
||||
};
|
||||
static const char *months_l[] = {
|
||||
"January", "February", "March", "April",
|
||||
"May", "June", "July", "August", "September",
|
||||
"October", "November", "December",
|
||||
};
|
||||
static const char *ampm[] = { "AM", "PM", };
|
||||
|
||||
oerrno = errno;
|
||||
|
||||
if (s == NULL || format == NULL || timeptr == NULL || maxsize == 0)
|
||||
return 0;
|
||||
@@ -228,6 +361,8 @@ strftime(char *s, size_t maxsize, const char *format, const struct tm *timeptr)
|
||||
if (strchr(format, '%') == NULL && strlen(format) + 1 >= maxsize)
|
||||
return 0;
|
||||
|
||||
oerrno = errno;
|
||||
|
||||
#ifndef POSIX_SEMANTICS
|
||||
if (first) {
|
||||
tzset();
|
||||
@@ -321,14 +456,14 @@ strftime(char *s, size_t maxsize, const char *format, const struct tm *timeptr)
|
||||
if (timeptr->tm_wday < 0 || timeptr->tm_wday > 6)
|
||||
strcpy(tbuf, "?");
|
||||
else
|
||||
strcpy(tbuf, days_a[timeptr->tm_wday]);
|
||||
strcpy(tbuf, days_a(timeptr->tm_wday));
|
||||
break;
|
||||
|
||||
case 'A': /* full weekday name */
|
||||
if (timeptr->tm_wday < 0 || timeptr->tm_wday > 6)
|
||||
strcpy(tbuf, "?");
|
||||
else
|
||||
strcpy(tbuf, days_l[timeptr->tm_wday]);
|
||||
strcpy(tbuf, days_l(timeptr->tm_wday));
|
||||
break;
|
||||
|
||||
case 'b': /* abbreviated month name */
|
||||
@@ -336,14 +471,14 @@ strftime(char *s, size_t maxsize, const char *format, const struct tm *timeptr)
|
||||
if (timeptr->tm_mon < 0 || timeptr->tm_mon > 11)
|
||||
strcpy(tbuf, "?");
|
||||
else
|
||||
strcpy(tbuf, months_a[timeptr->tm_mon]);
|
||||
strcpy(tbuf, months_a(timeptr->tm_mon));
|
||||
break;
|
||||
|
||||
case 'B': /* full month name */
|
||||
if (timeptr->tm_mon < 0 || timeptr->tm_mon > 11)
|
||||
strcpy(tbuf, "?");
|
||||
else
|
||||
strcpy(tbuf, months_l[timeptr->tm_mon]);
|
||||
strcpy(tbuf, months_l(timeptr->tm_mon));
|
||||
break;
|
||||
|
||||
case 'c': /* appropriate date and time representation */
|
||||
@@ -352,9 +487,16 @@ strftime(char *s, size_t maxsize, const char *format, const struct tm *timeptr)
|
||||
*
|
||||
* strftime(tbuf, sizeof tbuf, "%a %b %e %H:%M:%S %Y", timeptr);
|
||||
*
|
||||
* Now, per the ISO 1999 C standard, it this:
|
||||
* Per the ISO 1999 C standard, it was this:
|
||||
* strftime(tbuf, sizeof tbuf, "%A %B %d %T %Y", timeptr);
|
||||
*
|
||||
* Per the ISO 2011 C standard, it is now this:
|
||||
*/
|
||||
strftime(tbuf, sizeof tbuf, "%A %B %d %T %Y", timeptr);
|
||||
#ifdef HAVE_NL_LANGINFO
|
||||
strftime(tbuf, sizeof tbuf, nl_langinfo(D_T_FMT), timeptr);
|
||||
#else
|
||||
strftime(tbuf, sizeof tbuf, "%a %b %e %T %Y", timeptr);
|
||||
#endif
|
||||
break;
|
||||
|
||||
case 'C':
|
||||
@@ -497,9 +639,9 @@ strftime(char *s, size_t maxsize, const char *format, const struct tm *timeptr)
|
||||
case 'p': /* am or pm based on 12-hour clock */
|
||||
i = range(0, timeptr->tm_hour, 23);
|
||||
if (i < 12)
|
||||
strcpy(tbuf, ampm[0]);
|
||||
strcpy(tbuf, ampm(0));
|
||||
else
|
||||
strcpy(tbuf, ampm[1]);
|
||||
strcpy(tbuf, ampm(1));
|
||||
break;
|
||||
|
||||
case 'r': /* time as %I:%M:%S %p */
|
||||
@@ -560,11 +702,25 @@ strftime(char *s, size_t maxsize, const char *format, const struct tm *timeptr)
|
||||
break;
|
||||
|
||||
case 'x': /* appropriate date representation */
|
||||
strftime(tbuf, sizeof tbuf, "%A %B %d %Y", timeptr);
|
||||
/*
|
||||
* Up to the 2011 standard, this code used:
|
||||
* strftime(tbuf, sizeof tbuf, "%A %B %d %Y", timeptr);
|
||||
*
|
||||
* Now, per the 2011 C standard, this is:
|
||||
*/
|
||||
#ifdef HAVE_NL_LANGINFO
|
||||
strftime(tbuf, sizeof tbuf, nl_langinfo(D_FMT), timeptr);
|
||||
#else
|
||||
strftime(tbuf, sizeof tbuf, "%m/%d/%y", timeptr);
|
||||
#endif
|
||||
break;
|
||||
|
||||
case 'X': /* appropriate time representation */
|
||||
#ifdef HAVE_NL_LANGINFO
|
||||
strftime(tbuf, sizeof tbuf, nl_langinfo(T_FMT), timeptr);
|
||||
#else
|
||||
goto the_time;
|
||||
#endif
|
||||
break;
|
||||
|
||||
case 'y': /* year without a century, 00 - 99 */
|
||||
@@ -625,12 +781,12 @@ strftime(char *s, size_t maxsize, const char *format, const struct tm *timeptr)
|
||||
* Systems with tzname[] probably have timezone as
|
||||
* secs west of GMT. Convert to mins east of GMT.
|
||||
*/
|
||||
# if defined(__hpux) || defined (HPUX) || defined(__CYGWIN__)
|
||||
#if defined(__hpux) || defined (HPUX) || defined(__CYGWIN__)
|
||||
off = -timezone / 60;
|
||||
# else
|
||||
#else
|
||||
/* ADR: 4 August 2001, fixed this per gazelle@interaccess.com */
|
||||
off = -(daylight ? altzone : timezone) / 60;
|
||||
# endif
|
||||
#endif
|
||||
#else /* !HAVE_TZNAME */
|
||||
gettimeofday(& tv, & zone);
|
||||
off = -zone.tz_minuteswest;
|
||||
@@ -682,8 +838,12 @@ strftime(char *s, size_t maxsize, const char *format, const struct tm *timeptr)
|
||||
|
||||
#ifdef HPUX_EXT
|
||||
case 'N': /* Emperor/Era name */
|
||||
#ifdef HAVE_NL_LANGINFO
|
||||
strftime(tbuf, sizeof tbuf, nl_langinfo(ERA), timeptr);
|
||||
#else
|
||||
/* this is essentially the same as the century */
|
||||
goto century; /* %C */
|
||||
#endif
|
||||
|
||||
case 'o': /* Emperor/Era year */
|
||||
goto year; /* %y */
|
||||
@@ -694,7 +854,7 @@ strftime(char *s, size_t maxsize, const char *format, const struct tm *timeptr)
|
||||
case 'v': /* date as dd-bbb-YYYY */
|
||||
sprintf(tbuf, "%2d-%3.3s-%4ld",
|
||||
range(1, timeptr->tm_mday, 31),
|
||||
months_a[range(0, timeptr->tm_mon, 11)],
|
||||
months_a(range(0, timeptr->tm_mon, 11)),
|
||||
timeptr->tm_year + 1900L);
|
||||
for (i = 3; i < 6; i++)
|
||||
if (islower(tbuf[i]))
|
||||
@@ -925,6 +1085,7 @@ How nicer it depends on a compiler, of course, but always a tiny bit.
|
||||
#ifndef NULL
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
#include <locale.h>
|
||||
#include <sys/time.h>
|
||||
#include <string.h>
|
||||
|
||||
@@ -941,11 +1102,11 @@ static char *array[] =
|
||||
"(%%C) Century %C",
|
||||
"(%%D) date (%%m/%%d/%%y) %D",
|
||||
"(%%E) Locale extensions (ignored) %E",
|
||||
"(%%F) full month name, var length (January..December) %F",
|
||||
"(%%F) year-month-day (YYYY-MM-DD) %F",
|
||||
"(%%H) hour (24-hour clock, 00..23) %H",
|
||||
"(%%I) hour (12-hour clock, 01..12) %I",
|
||||
"(%%M) minute (00..59) %M",
|
||||
"(%%N) Emperor/Era Name %N",
|
||||
"(%%N) Emporer/Era Name %N",
|
||||
"(%%O) Locale extensions (ignored) %O",
|
||||
"(%%R) time, 24-hour (%%H:%%M) %R",
|
||||
"(%%S) second (00..60) %S",
|
||||
@@ -953,12 +1114,12 @@ static char *array[] =
|
||||
"(%%U) week of year, Sunday as first day of week (00..53) %U",
|
||||
"(%%V) week of year according to ISO 8601 %V",
|
||||
"(%%W) week of year, Monday as first day of week (00..53) %W",
|
||||
"(%%X) appropriate locale time representation (%H:%M:%S) %X",
|
||||
"(%%X) appropriate locale time representation (%%H:%%M:%%S) %X",
|
||||
"(%%Y) year with century (1970...) %Y",
|
||||
"(%%Z) timezone (EDT), or blank if timezone not determinable %Z",
|
||||
"(%%a) locale's abbreviated weekday name (Sun..Sat) %a",
|
||||
"(%%b) locale's abbreviated month name (Jan..Dec) %b",
|
||||
"(%%c) full date (Sat Nov 4 12:02:33 1989)%n%t%t%t %c",
|
||||
"(%%c) full date + newline (Sat Nov 4 12:02:33 1989)%n%t%t%t %c",
|
||||
"(%%d) day of the month (01..31) %d",
|
||||
"(%%e) day of the month, blank-padded ( 1..31) %e",
|
||||
"(%%h) should be same as (%%b) %h",
|
||||
@@ -966,7 +1127,7 @@ static char *array[] =
|
||||
"(%%k) hour, 24-hour clock, blank pad ( 0..23) %k",
|
||||
"(%%l) hour, 12-hour clock, blank pad ( 0..12) %l",
|
||||
"(%%m) month (01..12) %m",
|
||||
"(%%o) Emperor/Era Year %o",
|
||||
"(%%o) Emporer/Era Year %o",
|
||||
"(%%p) locale's AM or PM based on 12-hour clock %p",
|
||||
"(%%r) time, 12-hour (same as %%I:%%M:%%S %%p) %r",
|
||||
"(%%u) ISO 8601: Weekday as decimal number [1 (Monday) - 7] %u",
|
||||
@@ -981,12 +1142,8 @@ static char *array[] =
|
||||
/* main routine. */
|
||||
|
||||
int
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
long time();
|
||||
|
||||
char *next;
|
||||
char string[MAXTIME];
|
||||
|
||||
@@ -997,6 +1154,8 @@ char **argv;
|
||||
|
||||
long clock;
|
||||
|
||||
setlocale(LC_ALL, "");
|
||||
|
||||
/* Call the function. */
|
||||
|
||||
clock = time((long *) 0);
|
||||
@@ -1007,6 +1166,6 @@ char **argv;
|
||||
printf("%s\n", string);
|
||||
}
|
||||
|
||||
exit(0);
|
||||
return 0;
|
||||
}
|
||||
#endif /* TEST_STRFTIME */
|
||||
|
||||
+1
-1
@@ -43,7 +43,7 @@ typedef ssize_t breadfunc_t (int, char *, size_t);
|
||||
typedef ssize_t creadfunc_t (int, char *);
|
||||
|
||||
/* Initial memory allocation for automatic growing buffer in zreadlinec */
|
||||
#define GET_LINE_INITIAL_ALLOCATION 16
|
||||
#define GET_LINE_INITIAL_ALLOCATION 64
|
||||
|
||||
/* Derived from GNU libc's getline.
|
||||
The behavior is almost the same as getline. See man getline.
|
||||
|
||||
+3
-8
@@ -44,16 +44,14 @@ extern ssize_t zread (int, char *, size_t);
|
||||
|
||||
/* Dump contents of file descriptor FD to *OSTR. FN is the filename for
|
||||
error messages (not used right now). */
|
||||
int
|
||||
ssize_t
|
||||
zmapfd (int fd, char **ostr, const char *fn)
|
||||
{
|
||||
ssize_t nr;
|
||||
int rval;
|
||||
char lbuf[ZBUFSIZ];
|
||||
char *result;
|
||||
size_t rsize, rind;
|
||||
|
||||
rval = 0;
|
||||
result = (char *)xmalloc (rsize = ZBUFSIZ);
|
||||
rind = 0;
|
||||
|
||||
@@ -61,10 +59,7 @@ zmapfd (int fd, char **ostr, const char *fn)
|
||||
{
|
||||
nr = zread (fd, lbuf, sizeof (lbuf));
|
||||
if (nr == 0)
|
||||
{
|
||||
rval = rind;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
else if (nr < 0)
|
||||
{
|
||||
free (result);
|
||||
@@ -86,5 +81,5 @@ zmapfd (int fd, char **ostr, const char *fn)
|
||||
else
|
||||
free (result);
|
||||
|
||||
return rval;
|
||||
return (ssize_t)rind;
|
||||
}
|
||||
|
||||
+32
-60
@@ -46,10 +46,6 @@ extern char *realloc ();
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
||||
#if !defined (HAVE_BCOPY) && (defined (HAVE_STRING_H) || defined (STDC_HEADERS))
|
||||
# define bcopy(s, d, n) memcpy ((d), (s), (n))
|
||||
#endif
|
||||
|
||||
#else /* not HAVE_CONFIG_H */
|
||||
|
||||
#ifdef HAVE_STDLIB_H
|
||||
@@ -64,17 +60,11 @@ char *realloc ();
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
||||
/* Do this after the include, in case string.h prototypes bcopy. */
|
||||
#if (defined(HAVE_STRING_H) || defined(STDC_HEADERS)) && !defined(bcopy)
|
||||
#define bcopy(s, d, n) memcpy ((d), (s), (n))
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#ifdef _POSIX_VERSION
|
||||
|
||||
#include <fcntl.h>
|
||||
#endif
|
||||
|
||||
#endif /* not HAVE_CONFIG_H */
|
||||
|
||||
@@ -110,30 +100,31 @@ int bufsize = 128;
|
||||
#endif
|
||||
|
||||
#ifndef emacs
|
||||
static void memory_out (void);
|
||||
static void *xmalloc (size_t);
|
||||
static void *xrealloc (void *, size_t);
|
||||
|
||||
static void
|
||||
memory_out ()
|
||||
memory_out (void)
|
||||
{
|
||||
write (2, "virtual memory exhausted\n", 25);
|
||||
exit (1);
|
||||
}
|
||||
|
||||
static char *
|
||||
xmalloc (size)
|
||||
unsigned size;
|
||||
static void *
|
||||
xmalloc (size_t size)
|
||||
{
|
||||
register char *tem = malloc (size);
|
||||
register void *tem = malloc (size);
|
||||
|
||||
if (!tem)
|
||||
memory_out ();
|
||||
return tem;
|
||||
}
|
||||
|
||||
static char *
|
||||
xrealloc (ptr, size)
|
||||
char *ptr;
|
||||
unsigned size;
|
||||
static void *
|
||||
xrealloc (void *ptr, size_t size)
|
||||
{
|
||||
register char *tem = realloc (ptr, size);
|
||||
register void *tem = realloc (ptr, size);
|
||||
|
||||
if (!tem)
|
||||
memory_out ();
|
||||
@@ -147,15 +138,15 @@ xrealloc (ptr, size)
|
||||
for tgetnum, tgetflag and tgetstr to find. */
|
||||
static char *term_entry;
|
||||
|
||||
static char *tgetst1 ();
|
||||
static char *find_capability (char *, char *);
|
||||
static char *tgetst1 (char *, char **);
|
||||
|
||||
/* Search entry BP for capability CAP.
|
||||
Return a pointer to the capability (in BP) if found,
|
||||
0 if not found. */
|
||||
|
||||
static char *
|
||||
find_capability (bp, cap)
|
||||
register char *bp, *cap;
|
||||
find_capability (char *bp, char *cap)
|
||||
{
|
||||
for (; *bp; bp++)
|
||||
if (bp[0] == ':'
|
||||
@@ -167,8 +158,7 @@ find_capability (bp, cap)
|
||||
|
||||
__private_extern__
|
||||
int
|
||||
tgetnum (cap)
|
||||
char *cap;
|
||||
tgetnum (char *cap)
|
||||
{
|
||||
register char *ptr = find_capability (term_entry, cap);
|
||||
if (!ptr || ptr[-1] != '#')
|
||||
@@ -178,8 +168,7 @@ tgetnum (cap)
|
||||
|
||||
__private_extern__
|
||||
int
|
||||
tgetflag (cap)
|
||||
char *cap;
|
||||
tgetflag (char *cap)
|
||||
{
|
||||
register char *ptr = find_capability (term_entry, cap);
|
||||
return ptr && ptr[-1] == ':';
|
||||
@@ -192,9 +181,7 @@ tgetflag (cap)
|
||||
|
||||
__private_extern__
|
||||
char *
|
||||
tgetstr (cap, area)
|
||||
char *cap;
|
||||
char **area;
|
||||
tgetstr (char *cap, char **area)
|
||||
{
|
||||
register char *ptr = find_capability (term_entry, cap);
|
||||
if (!ptr || (ptr[-1] != '=' && ptr[-1] != '~'))
|
||||
@@ -220,9 +207,7 @@ static char esctab[]
|
||||
or NULL if PTR is NULL. */
|
||||
|
||||
static char *
|
||||
tgetst1 (ptr, area)
|
||||
char *ptr;
|
||||
char **area;
|
||||
tgetst1 (char *ptr, char **area)
|
||||
{
|
||||
register char *p, *r;
|
||||
register int c;
|
||||
@@ -313,10 +298,7 @@ static int speeds[] =
|
||||
|
||||
__private_extern__
|
||||
int
|
||||
tputs (str, nlines, outfun)
|
||||
register char *str;
|
||||
int nlines;
|
||||
register int (*outfun) ();
|
||||
tputs (char *str, int nlines, int (*outfun)(int))
|
||||
{
|
||||
register int padcount = 0;
|
||||
register int speed;
|
||||
@@ -392,10 +374,10 @@ struct buffer
|
||||
|
||||
/* Forward declarations of static functions. */
|
||||
|
||||
static int scan_file ();
|
||||
static char *gobble_line ();
|
||||
static int compare_contin ();
|
||||
static int name_match ();
|
||||
static int scan_file (char *, int, struct buffer *);
|
||||
static char *gobble_line (int, struct buffer *, char *);
|
||||
static int compare_contin (char *, char *);
|
||||
static int name_match (char *, char *);
|
||||
|
||||
#ifdef VMS
|
||||
|
||||
@@ -451,8 +433,7 @@ valid_filename_p (fn)
|
||||
|
||||
__private_extern__
|
||||
int
|
||||
tgetent (bp, name)
|
||||
char *bp, *name;
|
||||
tgetent (char *bp, char *name)
|
||||
{
|
||||
register char *termcap_name;
|
||||
register int fd;
|
||||
@@ -462,7 +443,7 @@ tgetent (bp, name)
|
||||
char *term;
|
||||
int malloc_size = 0;
|
||||
register int c;
|
||||
char *tcenv; /* TERMCAP value, if it contains :tc=. */
|
||||
char *tcenv = NULL; /* TERMCAP value, if it contains :tc=. */
|
||||
char *indirect = NULL; /* Terminal type in :tc= in TERMCAP value. */
|
||||
int filep;
|
||||
|
||||
@@ -621,10 +602,7 @@ tgetent (bp, name)
|
||||
or 0 if no entry is found in the file. */
|
||||
|
||||
static int
|
||||
scan_file (str, fd, bufp)
|
||||
char *str;
|
||||
int fd;
|
||||
register struct buffer *bufp;
|
||||
scan_file (char *str, int fd, struct buffer *bufp)
|
||||
{
|
||||
register char *end;
|
||||
|
||||
@@ -661,8 +639,7 @@ scan_file (str, fd, bufp)
|
||||
by termcap entry LINE. */
|
||||
|
||||
static int
|
||||
name_match (line, name)
|
||||
char *line, *name;
|
||||
name_match (char *line, char *name)
|
||||
{
|
||||
register char *tem;
|
||||
|
||||
@@ -677,8 +654,7 @@ name_match (line, name)
|
||||
}
|
||||
|
||||
static int
|
||||
compare_contin (str1, str2)
|
||||
register char *str1, *str2;
|
||||
compare_contin (char *str1, char *str2)
|
||||
{
|
||||
register int c1, c2;
|
||||
while (1)
|
||||
@@ -718,10 +694,7 @@ compare_contin (str1, str2)
|
||||
thing as one line. The caller decides when a line is continued. */
|
||||
|
||||
static char *
|
||||
gobble_line (fd, bufp, append_end)
|
||||
int fd;
|
||||
register struct buffer *bufp;
|
||||
char *append_end;
|
||||
gobble_line (int fd, struct buffer *bufp, char *append_end)
|
||||
{
|
||||
register char *end;
|
||||
register int nread;
|
||||
@@ -754,7 +727,7 @@ gobble_line (fd, bufp, append_end)
|
||||
else
|
||||
{
|
||||
append_end -= bufp->ptr - buf;
|
||||
bcopy (bufp->ptr, buf, bufp->full -= bufp->ptr - buf);
|
||||
memcpy (buf, bufp->ptr, bufp->full -= bufp->ptr - buf);
|
||||
bufp->ptr = buf;
|
||||
}
|
||||
if (!(nread = read (fd, buf + bufp->full, bufp->size - bufp->full)))
|
||||
@@ -799,8 +772,7 @@ main (argc, argv)
|
||||
printf ("am: %d\n", tgetflag ("am"));
|
||||
}
|
||||
|
||||
tprint (cap)
|
||||
char *cap;
|
||||
tprint (char *cap)
|
||||
{
|
||||
char *x = tgetstr (cap, 0);
|
||||
register char *y;
|
||||
|
||||
+15
-37
@@ -38,16 +38,8 @@ extern char *realloc ();
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
||||
#if !defined (HAVE_BCOPY) && (defined (HAVE_STRING_H) || defined (STDC_HEADERS))
|
||||
# define bcopy(s, d, n) memcpy ((d), (s), (n))
|
||||
#endif
|
||||
|
||||
#else /* not HAVE_CONFIG_H */
|
||||
|
||||
#if defined(HAVE_STRING_H) || defined(STDC_HEADERS)
|
||||
#define bcopy(s, d, n) memcpy ((d), (s), (n))
|
||||
#endif
|
||||
|
||||
#ifdef STDC_HEADERS
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@@ -72,23 +64,20 @@ memory_out ()
|
||||
exit (1);
|
||||
}
|
||||
|
||||
static char *
|
||||
xmalloc (size)
|
||||
unsigned size;
|
||||
static void *
|
||||
xmalloc (size_t size)
|
||||
{
|
||||
register char *tem = malloc (size);
|
||||
register void *tem = malloc (size);
|
||||
|
||||
if (!tem)
|
||||
memory_out ();
|
||||
return tem;
|
||||
}
|
||||
|
||||
static char *
|
||||
xrealloc (ptr, size)
|
||||
char *ptr;
|
||||
unsigned size;
|
||||
static void *
|
||||
xrealloc (void *ptr, size_t size)
|
||||
{
|
||||
register char *tem = realloc (ptr, size);
|
||||
register void *tem = realloc (ptr, size);
|
||||
|
||||
if (!tem)
|
||||
memory_out ();
|
||||
@@ -108,15 +97,11 @@ xrealloc (ptr, size)
|
||||
|
||||
The fourth and following args to tparam serve as the parameter values. */
|
||||
|
||||
static char *tparam1 ();
|
||||
static char *tparam1 (char *, char *, int, char *, char *, int *);
|
||||
|
||||
/* VARARGS 2 */
|
||||
char *
|
||||
tparam (string, outstring, len, arg0, arg1, arg2, arg3)
|
||||
char *string;
|
||||
char *outstring;
|
||||
int len;
|
||||
int arg0, arg1, arg2, arg3;
|
||||
tparam (char *string, char *outstring, int len, int arg0, int arg1, int arg2, int arg3)
|
||||
{
|
||||
int arg[4];
|
||||
|
||||
@@ -134,9 +119,7 @@ static char tgoto_buf[50];
|
||||
|
||||
__private_extern__
|
||||
char *
|
||||
tgoto (cm, hpos, vpos)
|
||||
char *cm;
|
||||
int hpos, vpos;
|
||||
tgoto (char *cm, int hpos, int vpos)
|
||||
{
|
||||
int args[2];
|
||||
if (!cm)
|
||||
@@ -147,12 +130,7 @@ tgoto (cm, hpos, vpos)
|
||||
}
|
||||
|
||||
static char *
|
||||
tparam1 (string, outstring, len, up, left, argp)
|
||||
char *string;
|
||||
char *outstring;
|
||||
int len;
|
||||
char *up, *left;
|
||||
register int *argp;
|
||||
tparam1 (char *string, char *outstring, int len, char *up, char *left, int *argp)
|
||||
{
|
||||
register int c;
|
||||
register char *p = string;
|
||||
@@ -173,21 +151,21 @@ tparam1 (string, outstring, len, up, left, argp)
|
||||
if (op + 5 >= outend)
|
||||
{
|
||||
register char *new;
|
||||
int offset = op - outstring;
|
||||
|
||||
if (outlen == 0)
|
||||
{
|
||||
outlen = len + 40;
|
||||
new = (char *) xmalloc (outlen);
|
||||
outend += 40;
|
||||
bcopy (outstring, new, op - outstring);
|
||||
memcpy (new, outstring, offset);
|
||||
}
|
||||
else
|
||||
{
|
||||
outend += outlen;
|
||||
outlen *= 2;
|
||||
new = (char *) xrealloc (outstring, outlen);
|
||||
}
|
||||
op += new - outstring;
|
||||
outend += new - outstring;
|
||||
op = new + offset;
|
||||
outend = new + outlen;
|
||||
outstring = new;
|
||||
}
|
||||
c = *p++;
|
||||
|
||||
Reference in New Issue
Block a user